> Here's an example of my first test, but I'm wondering how I setup the
> login routine so I can use it in future specs without repeating the
> method. Some sort of - before.each (:login)
You can use shared examples...
shared_examples_for "any page requiring authentication" do
fill_in :login, :with => @user.email
fill_in :password, :with => @user.password
click_button "login_button"
page.has_content?("Logged in successfully")
end
Then in your specs you can do:
describe User do
it_behaves_like "any page requiring authentication"
end
Patrick J. Collins
http://collinatorstudios.com
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users