Created
August 10, 2010 13:09
-
-
Save ianwhite/517236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(posted at http://groups.google.com/group/cukes/browse_thread/thread/4e01cc6e1a7071d4) | |
Hi Guys, | |
I'm the author of pickle, and despite this I broadly agree with Jonas' point of view. | |
The power of capybara is best realised when you do away with web_steps.rb, and start writing your own steps using capybara's dsl. | |
In my opinion, pickle is likewise. pickle_steps.rb is a general set of steps to both introduce the dev to the dsl, and enable rapid cuke writing in the early stages of a project. | |
I agree with Nick - the main point of pickle is to provide a general way of storing models for the lifetime of a scenario, and also to provide a general way of referring to them, so that you don't have to have step defs littered with variable names | |
In Jonas' example, I would keep his step defs, but write them with pickle's DSL, for example | |
Given /^there is a person called "Fred"$/ do | |
create_model('person "Fred"') | |
end | |
And then probably refactor this to (after I have writen the Ethel step) | |
Given /^there is a person called "(.+?)"$/ do |name| | |
create_model("person \"#{name}\"') | |
end | |
This then means I need to write just one step to, say go to a person's account page | |
When /^I go to "(.+?)"'s account page$/ do |name| | |
visit "/accounts/#{model!("person \"#{name.id}\")} # or whatever | |
end | |
instead of writing 2 (or 3 or 4) steps, each the same except for the ivar name. | |
Similarly for the fatherhood step | |
Given /^"(.+?)" is the father of "(.+?)"$/ do |father, child| | |
Fatherhood.create! :father => model!(father), :child => model!(child) | |
end | |
So, I think that keeping code out of features is right, but I don't think that pickle users are required to do this, any more than capybara users are required to use css selectors. In other words, pickle_steps.rb is an invitation to use pickle's dsl to write reusable steps of your own. | |
However, I think that pickle's docs should make this clearer, and the dsl could be improved (both things that we are working on). | |
Cheers, | |
Ian |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment