aslak hellesoy wrote:
> give buttons unique dom ids and pass the id to #clicks_button ?
Of course that's the easy way to do it :)
I was hoping to keep my stories a bit closer to English. Plus then I'd
need some extra instance variable so that step can calculate the dom_id.
Here is an example of what I'm going for:
Scenario: Accepting a friend request
Given there is a user named "Fred"
And I am logged in as a normal user named "Joe"
And there is an unaccepted invite from "Fred" to me
And there is a user named "Sally"
And there is an unaccepted invite from "Sally" to me
When I go to "the invites from friends page"
And I push "accept" near "Fred"
# I want to avoid: And I push #accept_button_user_1
Then I should see "Now you are friends with Fred"
When I push "ignore" near "Sally"
Then I should see "Sally won't ever bother you again"
Or maybe you are suggesting:
Scenario: Accepting a friend request
Given there is a user named "Fred"
And I am logged in as a normal user named "Joe"
And there is an unaccepted invite from "Fred" to me
And there is a user named "Sally"
And there is an unaccepted invite from "Sally" to me
When I go to "the invites from friends page"
And I push "accept" for user "Fred"
Then I should see "Now you are friends with Fred"
When I push "ignore" for user "Sally"
Then I should see "Sally won't ever bother you again"
with this matcher:
When /^I push "(.*)" for user "(.*)"$/ do |button, user_name|
user = User.find_by_name(user_name)
scope.clicks_button("accept_#{dom_id(user)}")
end
Am I putting too much thought into this?
Paul
P.S. I am sorry if this has been a dumb question. I'm still just trying
to learn the best way to approach this stuff.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users