Really useful and helpful tips about pickle, table-diffs and debugging cucumber.
Each one was just what I need to improve ^^.
So thanks Ryan and keep going ^^
HINT:
WHEN you get
Word verification response is incorrect, please try again.
THEN enable scripts for recaptcha.net to submit your comment
AS it did not show up otherwise.
I love using Pickle. It really speeds up writing Cucumber features and lets me focus on the real issue and not waste time on setup. Check out the Pickle readme for more detail on what this gem can do. I've also written a post that provides some more detail too: http://rubyflare.com/2009/10/28/pickle-my-cucumber/
@stu Pickle doesn't have anything built to handle the deletion of records but it isn't hard to create your own step definition using Pickle to achieve this: http://gist.github.com/224945
Pickle doesn't work form me!! I even download the episode source code and when i run "cucumber features", cucumber doesn't recognice the pickle steps!! Any suggestion?
@dani have you performed a ruby script/generate pickle? This will append pickle setup to features/support/env.rb and create a new file at features/step_definitions/pickle_steps.rb
But how about addressing this with has many through? Right now, I am trying to make an account sign up form. My app has an Account which has_one company, Company has many users, and Account has many users through Company. I want this form to have fields for the Account, the Company, and the User. Rails is giving me all sort of problems trying to do this http://pastie.org/780854 . After seeing tons of people with the same question in forums with no answers, and not too much help in IRC, I think this would be a great talking point.
For those of you wondering about aligning the table, it's a feature that comes with the textmate bundle. The most recent version does not support CMD+OPT+\ - instead hit CMD+S to save and align your tables.
incredible how you manage to always present stuff that I need at that very moment.
Really useful and helpful tips about pickle, table-diffs and debugging cucumber.
Each one was just what I need to improve ^^.
So thanks Ryan and keep going ^^
HINT:
WHEN you get
Word verification response is incorrect, please try again.
THEN enable scripts for recaptcha.net to submit your comment
AS it did not show up otherwise.
I think show me the page will come in very handy... Thanks for the tip! =)
thanks for this great screencast (again!).
I'm also borred with the paths.rb file, so I have added this:
http://gist.github.com/224038
So you can write: "When I go to the products page" and it'll automagically be converted to products_page method. Great right?
Great screencast Ryan! Thanks.
How did you reformat that table in textmate?
I haven't watched it yet, but SWEET!
Good choice!
Thanks Ryan.
Yeah ditto what @Tick said. Your psychic powers are uncanny. Thanks for this and all the other extremely useful episodes.
Thanks for the great tips in this episode - really timely (ok, stop reading our minds!).
The table reformat comes from Cucumber textmate bundle Command/Option '\'
(probably)
Hi Ryan,
thnx for another great episode...
....please give us more on BDD!
greez
@thibaud - did you try script/generate pickle paths ?
This adds mapping of expressions like 'the product's edit page' and even nested ones like 'the category's product's page'.
Cheers,
ian
Then show me the page
Didn't know about that - thanks! Sure woulda saved me a lot of debugging time.
I had to do this to get it working
config.gem 'ianwhite-pickle', :lib => 'pickle'
Pickle looks awesome.
I recently posted a similiar Gem called "Cucumber Factory" which shares a lot of ideas with Pickle but focuses on very natural syntax.
Check it out on GitHub:
http://github.com/makandra/cucumber_factory
Yes, its advanced, but you teach us during 186 episodes and that's a lot! Thanks for your work! Always a good motivation to continue studying...
Nevermind my last comment. I seem to have missed the migration to gemcutter.
I love using Pickle. It really speeds up writing Cucumber features and lets me focus on the real issue and not waste time on setup. Check out the Pickle readme for more detail on what this gem can do. I've also written a post that provides some more detail too: http://rubyflare.com/2009/10/28/pickle-my-cucumber/
Does pickle have a way to delete all records?
eg
Givin I have no xx records?
@stu Pickle doesn't have anything built to handle the deletion of records but it isn't hard to create your own step definition using Pickle to achieve this: http://gist.github.com/224945
As usual, Great cast!!
I tried to convert the table into lists as follows in the view:
<ul id="products">
<% @products.each do |product| -%>
<li><%= h(product.name) %></li>
<li><%= number_to_currency product.price %></li>
<% end -%>
</ul>
with step definition:
Then(/^I should see products table$/) do |expected_table|
html_table = element_at("#products").to_table
#html_table.map! { |r| r.map! { |c| c.gsub(/<.+?>/, '') } }
expected_table.diff!(html_table)
end
But I could not figure out the error. Whats wrong with my setp def?? plz.
Is there any way to control the junk posts like above? Please do something... these guys are annoying.
By the way-Great episode and thank you for that.
Thanks Ryan for great Casts!
They truly open RoR for many people.
Pickle doesn't work form me!! I even download the episode source code and when i run "cucumber features", cucumber doesn't recognice the pickle steps!! Any suggestion?
@dani have you performed a ruby script/generate pickle? This will append pickle setup to features/support/env.rb and create a new file at features/step_definitions/pickle_steps.rb
When I went from webrat 0.6.0 to 0.5.3 I didn't get
the undefined method `css_search' for Webrat::XML:Module (NoMethodError) (eval):2:in `table_at' error.
I saw a post on the IRC channel saying they removed css_search from webrat???
http://irclogger.com/cucumber/2009-10-28#1256763887
cheers
Ryan your final tip was truly Steve Jobs-esque! Saving the best till last ;-)
Great episode as ever.
Ryan, thanks for the video on this.
But how about addressing this with has many through? Right now, I am trying to make an account sign up form. My app has an Account which has_one company, Company has many users, and Account has many users through Company. I want this form to have fields for the Account, the Company, and the User. Rails is giving me all sort of problems trying to do this http://pastie.org/780854 . After seeing tons of people with the same question in forums with no answers, and not too much help in IRC, I think this would be a great talking point.
Thanks, let me know
Initial setup problem was only a single quote issue:
Given a user exists with first_name: 'Jason'
this wouldn't work for me and I pulled my hair out just to find out that all I needed was double quotes:
Given a user exists with first_name: "Jason"
I submitted a lighthouse ticket:
http://is.gd/8QcDx
Great screencast again.
The table_at does not seem to work anymore here.
For those of you wondering about aligning the table, it's a feature that comes with the textmate bundle. The most recent version does not support CMD+OPT+\ - instead hit CMD+S to save and align your tables.
@Philipp Kursawe
Cucumber deprecated table_at and element at so do this:
html_table = tableish("table#products tr", "td" ).to_a
You're basically telling cucumber it is a table with product id, tr has header and td for columns.
And also looks like you don't need to escape symbols anymore.
GL.
I am new to rails and pickle testing. I want to use polymorphic_path for post's comment's new page. Is there any way to write it?
I tried
when /^#{capture_model}(?:'s)? #{capture_model}'s (.+?) page$/
polymorphic_path(model($1, $2), :action => $3) (I am just guessing here)
It is giving "wrong number of arguments (3 for 2)" error.
Also for post's new page:
when /^#{capture_model}(?:'s)? (.+?) page$/
polymorphic_path(model($1), :action => $2)
It is giving ""undefined method `model_name' for NilClass:Class" error.
I am assuming that the polymorphic_path is for creating paths. Please correct me, if I am wrong!
You need to kill time, you need entertainment. Refer to our website. Hope you get the most comfort.