Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1-beta1
    • Component/s: Testing
    • Labels:
      None

      Description

      For apps with complex url mappings, it''s going to be necessary to allow testing of the mappings.

      Consider the mappings...

      "/$version"(controller: "version", action: "show") {
      constraints

      { version(matches:/^\d.*/) }

      }
      "/$controller/$action?/$id?"

      The test cases might look like...

      class UrlMappingsTest extends GrailsUrlMappingTest {

      void testVersionMappings() {
      assertUrlMapping("/1.0")

      { assertEquals("version", controller) assertEquals("show", action) assertEquals("1.0", params.version) }

      assertUrlMapping("/other")

      { assertEquals("other", controller) }

      }
      }

      1. GrailsUrlMappingsTestCase.groovy
        8 kB
        Luke Daley
      2. GrailsUrlMappingTestCaseTests.groovy
        8 kB
        Luke Daley
      3. UrlMappingsTests.groovy
        2 kB
        Glenn Saqui

        Activity

        Hide
        Luke Daley added a comment -

        Committed, where should I write the documentation?

        Show
        Luke Daley added a comment - Committed, where should I write the documentation?
        Hide
        Peter Ledbrook added a comment -

        If you're ready to write it, add it to a "Testing Plugin" page on the Grails website. I'll transfer that documentation across to the reference guide for 1.1 at some point.

        Show
        Peter Ledbrook added a comment - If you're ready to write it, add it to a "Testing Plugin" page on the Grails website. I'll transfer that documentation across to the reference guide for 1.1 at some point.
        Hide
        Luke Daley added a comment -

        Documentation @ http://www.grails.org/Testing+URL+Mappings.

        As far as I am aware, this ticket is now resolved.

        Show
        Luke Daley added a comment - Documentation @ http://www.grails.org/Testing+URL+Mappings . As far as I am aware, this ticket is now resolved.
        Hide
        Peter Ledbrook added a comment -

        Thanks for implementing this Luke.

        Show
        Peter Ledbrook added a comment - Thanks for implementing this Luke.
        Hide
        Graeme Rocher added a comment -

        Bulk closing bunch of resolved issues

        Show
        Graeme Rocher added a comment - Bulk closing bunch of resolved issues

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Luke Daley
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development