> 1. actually log in (i.e. create a user, go to the login screen and log > in). You can wrap this in a single step definition like "Given I am > logged in as 'admin'", but you still have to go through the app within > the step definition. I do this. Here is example:
Scenario: guest becomes a user Given I am guest When I go to the signup_path And puts signup info Then new user should be created And I should signin > Smth. Given /^I am guest$/ do get_me_the_cookies.should eq([]) end When /^I go to the signup_path$/ do visit signup_path end When /^puts signup info$/ do fill_in "user_username", :with => "frankpopp" fill_in "user_first", :with => "Frank" fill_in "user_second", :with => "Popp" fill_in "user_password", :with => "123456" fill_in "user_password_confirmation", :with => "123456" click_button "Sign up!" end Then /^new user should be created$/ do page.should have_content("New user added: frankpopp") end Then /^I should signin$/ do is_user?.should be_true end > in users_controller.rb: def create @user = User.new(params[:user]) if @user.save session[:user_id] = @user.id # This create a session flash[:success] = "New user added: " + @user.username flash[:notice] = "His password is: " + @user.password if is_admin? redirect_to @user else end end -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users