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

Deprecate and then remove keyword methods from World #68

Closed
mattwynne opened this issue May 26, 2011 · 22 comments
Closed

Deprecate and then remove keyword methods from World #68

mattwynne opened this issue May 26, 2011 · 22 comments
Assignees

Comments

@mattwynne
Copy link
Member

Just try this:

Before { puts self.methods }

The World is polluted with hundreds of methods generated from all the different languages' step keywords. We should deprecate these, and direct people to simply use #steps instead.

@mattwynne
Copy link
Member Author

#149 will need to be addressed first.

mattwynne added a commit that referenced this issue Oct 16, 2011
@aslakhellesoy
Copy link
Contributor

Closing this since History on master says this is done.

@mattwynne
Copy link
Member Author

Well they're been deprecated, but not removed. Shouldn't we leave this open until we do a 0.x release and remove them altogether?

@danil-z
Copy link

danil-z commented Nov 1, 2011

I'm wondering how to use new method #step???
i had the step definition like this:

When /^I fill in "([^\"]*)" translation with "([^\"]*)"$/ do |field, value|
  fill_in(I18n.t(field), :with => value) 
end

how i should rewrite it now? can't find any documentation of new way...

@mattwynne
Copy link
Member Author

Something like this should work:

step %{I fill in "#{field}" translation with "#{value}"}

Does that help?

@danil-z
Copy link

danil-z commented Nov 2, 2011

yes,
add it to i18 translations please like all other keywords ->
cucumber --i18n ru

@mattwynne
Copy link
Member Author

I do not understand your request. Could you please explain what you're asking for again?

@jpatokal
Copy link
Contributor

jpatokal commented Nov 4, 2011

"WARNING: i18n methods within step definitions are deprecated" is the worst error message ever, it just took me half an hour of poking around to figure out what the hell it's trying to say and track this down. How about some plain English?

"Using 'Given/When/Then' in step definitions is deprecated, use 'step' to call other steps instead."

For extra credit, replace Given/When/Then with the appropriate localizations in the current environment. (Not that this really matters, since the error is hardcoded English anyway...)

@aslakhellesoy
Copy link
Contributor

@jpakotal have some self respect dude. Instead of just whining you should send a pull request.

@jpatokal
Copy link
Contributor

jpatokal commented Nov 4, 2011

I'm "whining" here so Google can match the error message to this issue and other people can figure out WTF is going on when they see that, but no, I'm not going to fork cucumber and send you a pull request to update a bloody static text string. Cut, paste, commit, be happy.

@aslakhellesoy
Copy link
Contributor

@jpakotal. You don't have to be abrasive to make google match the error message to this issue. This software is written by volunteers in their own spare time, with the best of intentions.

It's therefore very discouraging every time someone comes around and points out something that may be correct, but in a patronising and ungrateful tone. Nobody cares how long it took you to figure out what the error message says.

We appreciate contributions, but please be respectful. Otherwise you'll just be ignored.

@aslakhellesoy
Copy link
Contributor

@mattwynne - can you fix this one? You have the best insight into what was changed, why and how it should be worded.

@ghost ghost assigned aslakhellesoy Nov 4, 2011
@aslakhellesoy aslakhellesoy reopened this Nov 4, 2011
@mattwynne
Copy link
Member Author

Sure, when I have time :)

@jpatokal
Copy link
Contributor

jpatokal commented Nov 4, 2011

@aslakhellesoy: See, if you had followed your own advice and asked me nicely, I would've happily sent you the pull request. But telling an already pissed-off user who is taking the time to notify you about a problem in your software to "have some self respect" and stop "whining" is not the way to get that user to volunteer some of their spare time to help you!

Anyway, now that I've calmed down, I apologize for my original abrasiveness... and here's the pull request. Here's hoping it makes a great piece of software a little bit greater.

@mattwynne
Copy link
Member Author

Thanks. Closing this ticket.

@gkop
Copy link

gkop commented Nov 5, 2011

@mattwynne , I found that cucumber wants you to drop the When, Given, Then when you use the step method.

In other words, instead of

step %{When I fill in "#{field}" translation with "#{value}"}

It wants you to use

step %{I fill in "#{field}" translation with "#{value}"}

Here's the quick regex I used to convert my old steps to the new DSL:

$ find . -type f | xargs perl -pi -e 's/(And|When|Then|Given) %(Q)?\{(.+)\}/step %\{\3}/g'

@mattwynne
Copy link
Member Author

You're quite right - sorry for the misleading comment above. I'll edit to remove confusion for future readers.

gga pushed a commit to gga/cucumber that referenced this issue Nov 7, 2011
@mattwynne
Copy link
Member Author

Related to #171

@hraynaud
Copy link

Not sure I fully understand this issue. I'm getting this but I'm not using a internationalization (at least not explicitly).

Is the solution to replace Given/When/Then/And universally with step? I tried this but it cause all my test to break.
Any clarification would be appreciated.

Thanks

@jpatokal
Copy link
Contributor

The issue is that you are using Given/When/Then/And within a step to reference another step. This is no longer allowed, you have to say "step Blah blah" instead of "Given blah blah".

I've also updated the Wiki page accordingly: https://github.com/cucumber/cucumber/wiki/Calling-Steps-from-Step-Definitions

@hraynaud
Copy link

Great that's what I thought but I wasn't sure. Thanks again.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants