Hi all

I just recently started to use rspec and I'm having a problem using  
multple scenarios in one story. These are the two scenarios, trying to  
test my implemenation of the new http authentication in rails 2:

   Scenario "user has to authenticate" do
     Given "an anonymous user" do
     end
     When "visiting", "working_page" do |page|
       get page
     end
     Then "it should return 401 Unauthorized on each request" do
       response.headers["Status"].should == "401 Unauthorized"
     end
   end

   Scenario "user authenticates so the page should return 200" do
     Given "a user"; end
     When "visiting", "working_page" do |page|
       get page, nil, :authorization =>  
ActionController::HttpAuthentication::Basic.encode_credentials("name",  
"pass")
     end
     Then "I'm logged in" do
       response.should be_success
     end
   end

What happens is that the second scenario's response is also returning  
401 and if I switch the order of the two scenarios, the second  
scenario (now the one that should return 401) returns 200. Each  
scenario works if I remove the other one.

thanks for any help!
Ivo Dancet
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to