I know that this will end up being pebkac... but it still is annoying
So i have a problem. webrat is not acting how i thought it was supposed to. Ryan Bate's railscast on cucumber made this shit look so easy. And for the most part, it is.
However, when you go beyond what he had in his railscast - beginning cucumber, webrat takes me off the rails very fast.
to the Code...
all i wanted to do was select my choice from a dropdown menu. According to webrat/cucumber webrat_steps.rb file it should beI select "option" from "field"
So in my scenario, i used the field name "tweet[style_id]" and the option "story".I select "story" from "tweet[style-id]"
You may be wondering what that tweet[ ] business is all about, well that was the only way my scenario would go green, is if i used the label name in that style of code. Since i am not using a symbol in my f.label :body, "I want to show this text"
if you were simply using f.label :body, you wouldn't need the tweet[ ] syntax.
Updates
i did find this ruby forum post, however he simply had the wrong description text. Since my text is one word, and i copied and pasted from the view source code, i don't think that is my problemo. Maybe i should try using the label field without the quotes?
Given a model:
ReplyDeleteclass Load < ActiveRecord::Base
belongs_to :pilot, :class_name => "Account"
end
When I have a view with:
form_for @load do |f|
f.label :pilot_id, 'Pilot:'
f.collection_select(:pilot_id, Account.pilots, :id, :name, { :prompt => true }, :class => :inputbox)
end
Then this Cucumber step works:
And I select "Polly" from "Pilot"
Hope this helps,
Bryan
thanks Bryan. it seems that whatever problem i was having has also been eradicated with an upgrade to the latest cucumber. appreciate the comment.
ReplyDelete