Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format step method dynamically without parameters #189

Closed
nikowitt opened this issue Feb 18, 2016 · 5 comments · Fixed by #215
Closed

Format step method dynamically without parameters #189

nikowitt opened this issue Feb 18, 2016 · 5 comments · Fixed by #215
Assignees
Milestone

Comments

@nikowitt
Copy link
Contributor

Hi Jan,

we've implemented some steps that are within some date ranges like this:

Given logged in user is system
     And  today is 2016-02-18
     And  response for rfqquestionnaire that is submittable by suma.contact@sobis.com
     And corresponding RfQ
    When start date is set to 2015-08-18 and due date is set to 2016-05-18
     And question changes
    Then no errors are raised

To be able to render the second (today) line, I need to supply the current date as a parameter, but I prefer to have a helper method like today() without having to supply a parameter. With @NestedSteps, this could be wrapped a little bit, but it is only a workaround. So basically I have to be able to have something similar to the CaseDescriptionProvider for step method that allows me to to some coding.

Is this already possible somehow?

Best regards,
Niko

@janschaefer
Copy link
Contributor

Yes. This is actually something which I also wanted to have myself sometimes :-)

@janschaefer janschaefer added this to the v0.11.2 milestone Feb 18, 2016
@janschaefer janschaefer modified the milestones: v0.11.3, v0.11.2 Feb 25, 2016
@janschaefer janschaefer modified the milestones: v0.12.0, v0.11.3 Mar 20, 2016
@Airblader
Copy link
Contributor

So basically we need the provider mechanism in the @As annotation, right?

@Airblader Airblader self-assigned this Jul 11, 2016
@Airblader
Copy link
Contributor

I'm working on this. Just need to write tests, the rest is done.

@janschaefer Is there a specific reason why this pattern is called *Generator for some cases and *Provider for others?

Airblader added a commit to Airblader/JGiven that referenced this issue Jul 11, 2016
This change extends the @as annotation for step / stage methods and classes
with an AsProvider provider() method to allow a more flexible way of
customizing the result.

fixes TNG#189
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 11, 2016
This change extends the @as annotation for step / stage methods and classes
with an AsProvider provider() method to allow a more flexible way of
customizing the result.

fixes TNG#189
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 11, 2016
This patch changes the behavior for the DefaultAsProvider by moving the
case of absent @as annotations into the provider. This allows us to just
fall back to the default provider and allows users to utilize the default
behavior by extending from DefaultAsProvider.

relates to TNG#189
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 11, 2016
This patch changes the behavior for the DefaultAsProvider by moving the
case of absent @as annotations into the provider. This allows us to just
fall back to the default provider and allows users to utilize the default
behavior by extending from DefaultAsProvider.

relates to TNG#189
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 11, 2016
@Airblader
Copy link
Contributor

@nikowitt Would you mind taking a look at the PR to see whether the example I posted there covers what you originally asked for? Just want to make sure the implementation fits the request. Thanks!

@nikowitt
Copy link
Contributor Author

nikowitt commented Jul 12, 2016

Looks like a flexible solution hat fits the requirements. Thank you!

Airblader added a commit to Airblader/JGiven that referenced this issue Jul 12, 2016
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 12, 2016
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 12, 2016
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 12, 2016
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants