Grails
  1. Grails
  2. GRAILS-8437

Mocked views do not work on Windows

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-RC3
    • Fix Version/s: 2.0 final
    • Component/s: Testing
    • Labels:
      None

      Description

      When mocking views by assigning something like:

      views['/foo/_bar.gsp'] = 'Mocked view content'
      

      the mocked views take priority over any existing GSP in grails-app/views.

      On Windows however, the real GSP takes priority. The only way the mocked view will work is if there is no real GSP with the same path.

        Activity

        Hide
        Robert Fletcher added a comment - - edited

        Debugger findings:

        breakpoint set at DefaultGroovyPageLocator:329 (in findResource method)

        On OSX

        1. loader = GroovyPageUnitTestResourceLoader, resource = FileSystemResource with path /Users/rob/Workspace/sandpit/views-test/grails-app/views/grails-app/views/recommendation/_foo.gsp (note repeated grails-app/views). Resource does not exist
        2. loader = GrailsWebApplicationContext, resource = ServletContextResource with path /grails-app/views/recommendation/_foo.gsp. Resource does not exist
        3. loader = GroovyPageUnitTestResourceLoader, resource = ByteArrayResource. Resource exists & is used

        On Windows

        1. loader = GroovyPageUnitTestResourceLoader, resource = FileSystemResource with path /Users/rob/Workspace/sandpit/views-test/grails-app/views/grails-app/views/recommendation/_foo.gsp (note repeated grails-app/views). Resource does not exist
        2. loader = GrailsWebApplicationContext, resource = ServletContextResource with path /grails-app/views/recommendation/_foo.gsp. Resource exists & is used
        Show
        Robert Fletcher added a comment - - edited Debugger findings: breakpoint set at DefaultGroovyPageLocator:329 (in findResource method) On OSX loader = GroovyPageUnitTestResourceLoader, resource = FileSystemResource with path /Users/rob/Workspace/sandpit/views-test/grails-app/views/grails-app/views/recommendation/_foo.gsp (note repeated grails-app/views). Resource does not exist loader = GrailsWebApplicationContext, resource = ServletContextResource with path /grails-app/views/recommendation/_foo.gsp. Resource does not exist loader = GroovyPageUnitTestResourceLoader, resource = ByteArrayResource. Resource exists & is used On Windows loader = GroovyPageUnitTestResourceLoader, resource = FileSystemResource with path /Users/rob/Workspace/sandpit/views-test/grails-app/views/grails-app/views/recommendation/_foo.gsp (note repeated grails-app/views). Resource does not exist loader = GrailsWebApplicationContext, resource = ServletContextResource with path /grails-app/views/recommendation/_foo.gsp. Resource exists & is used
        Hide
        Robert Fletcher added a comment -

        I'm not sure if I should be committing changes right now so I'll attach a diff instead. This fixes the issue & doesn't seem to break anything.

        Show
        Robert Fletcher added a comment - I'm not sure if I should be committing changes right now so I'll attach a diff instead. This fixes the issue & doesn't seem to break anything.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Robert Fletcher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development