package com.tngtech.jgiven.spock

import com.tngtech.jgiven.annotation.ExtendedDescription
import com.tngtech.jgiven.spock.stages.Given
import com.tngtech.jgiven.spock.stages.Then
import com.tngtech.jgiven.spock.stages.When
import spock.lang.Unroll

class ShinySpockJGivenShould extends ScenarioSpec<Given, When, Then> {

    def "something should happen"() {
        expect:

        given().some_state()
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.description == "something should happen"
    }

    def "be some able to use params"() {
        expect:

        given().some_state_$("param")
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.scenarioCases.first().getStep(0).words.join(" ") == "Given some state param"
    }

    @ExtendedDescription("more details")
    def "be able to have extended descriptions"() {
        expect:

        given().some_state()
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.extendedDescription == "more details"
    }

    @Unroll
    def "be able to use tables #param"() {
        expect:
        given().some_state_$(param)
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.getDescription() == "be able to use tables #param"

        where:
        param        | _
        "param"      | _
        "word param" | _
    }
}

package com.tngtech.jgiven.spock

import com.tngtech.jgiven.annotation.ExtendedDescription
import com.tngtech.jgiven.spock.stages.Given
import com.tngtech.jgiven.spock.stages.Then
import com.tngtech.jgiven.spock.stages.When

class ShinySpockJGivenShould extends ScenarioSpec<Given, When, Then> {

    def "something should happen"() {
        expect:

        given().some_state()
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.description == "something should happen"
    }

    def "be some able to use params"() {
        expect:

        given().some_state_$("param")
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.scenarioCases.first().getStep(0).words.join(" ") == "Given some state param"
    }

    @ExtendedDescription("more details")
    def "be able to have extended descriptions"() {
        expect:

        given().some_state()
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.extendedDescription == "more details"
    }

    def "be able to use tables #param"() {
        expect:
        given().some_state_$(param)
        when().some_action()
        then().some_outcome()

        assert scenario.scenarioModel.getDescription() == "be able to use tables #param"

        where:
        param        | _
        "param"      | _
        "word param" | _
    }
}

Remove Unroll because it is default behaviour
Remove Unroll because it is default behaviour

Signed-off-by: Javier Salinas <93f4051795330681b8e328b46eb591242bd9e859@gmail.com>
