re-arranged functional spec for creation to use one testcase and added another one for invalid data
re-arranged functional spec for creation to use one testcase and added another one for invalid data

package shortener.add

import geb.spock.GebReportingSpec
import pages.*

class AddShortenerFunctionalSpec extends GebReportingSpec {


    def "a valid shortener will be created and check if the redirection works"() {

        given: "i am at the shortener index page"
        to ShortenerIndexPage

        when: "i click on the create button"
        page.addShortener()

        then: "i am at the creation page"
        at ShortenerCreatePage

        when: "i fill in valid information for the shortner"
        page.setFormValues("http://www.google.com", "Dummy User")
        page.save()

        then: "the shortener was created successfully"
        at ShortenerShowPage
        page.isSuccessMessageHere()

        when: "i follow the generated Short-URL"
        page.clickShortUrl()

        then: "i am at the desired destination url"
        driver.currentUrl.contains "google"
    }


    def "an invalid shortener can not be saved and will display error messages"() {

        given: "i am at the shortener index page"
        to ShortenerIndexPage

        when: "i click on the create button"
        page.addShortener()

        then: "i am at the creation page"
        at ShortenerCreatePage

        when: "i fill in valid information for the shortner"
        page.setFormValues("noValidUrl", "")
        page.save()

        then: "the shortener was created successfully"
        at ShortenerCreatePage

    }


}
package shortener.add

import geb.spock.GebReportingSpec
import pages.*
import spock.lang.Stepwise

@Stepwise
class AddShortenerFunctionalSpec extends GebReportingSpec {


    def "when i click on the create button at the index page"() {
        when:
        to ShortenerIndexPage

        page.addShortener()

        then:
        at ShortenerCreatePage

    }

    def "and i fill in valid information for the shortner"() {
        given:
        at ShortenerCreatePage

        when:
        page.setFormValues("http://www.google.com", "Dummy User")

        and:
        page.save()

        then:
        at ShortenerShowPage
        page.isSuccessMessageHere()

    }

    def "then i'm at the show page of the new shortener and can follow the generated Short-URL"() {

        when:
        page.clickShortUrl()

        then:
        driver.currentUrl.contains "google"

    }



}