[rspec-users] [cucumber] webrat+selenium integration problem: record n

Balint Erdi lists at ruby-forum.com
Wed Mar 25 21:00:16 EDT 2009

Ben Mabey wrote:

> With that step definition you don't need to pollute all of your features
> with the steps to login.  As it turns out you can have the best of both
> worlds.  Meaning, if you want webrat to use the faster post method only
> for non-selenium runs you can.  Like so:
>   Given /^I log in as "(.*)"$/ do |login_name|
>     @user = User.find_by_login(login_name)
>     webrat.atutomate do
>       vist "/session"
>       fill_in "login", :with => login_name
>       fill_in "password", :with => 'secret'
>       click_button "entrar"
>     end
>     webrat.simulate do
>       post "/session", :login => @user.login, :password => 'secret'
>     end
>   end

Excellent (and elegant), it works now!

Thank you for your help along the way,
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list