Hi all,
Have been following:
http://www.tomtenthij.co.uk/2008/1/25/rspec-plain-text-story-runner-on-a-fresh-rails-app
..as an introduction into the story runner.
It shows how to get a couple of scenarios going to test the
restful_authenticated plugin from plain text stories.
I thought I'd go completely bonkers and try and add a story of my own :)
Scenario: Registered user logs in
Given a username 'jdoe'
And a password 'letmein'
And an existing user with these credentials
When the user logs in with username and password
Then should redirect to '/'
And I added these steps to try and make this pass:
Given "an existing user with these credentials" do
@user = User.new({ :login => @username,
:password => @password,
:password_confirmation => @password,
:email => "[EMAIL PROTECTED]" })
@user.save
User.find_by_login(@username).should_not be_nil
end
When "the user logs in with username and password" do
post "/sessions/create", :user => { :login => @username, :password
=> @password }
end
Then "should redirect to '$path'" do |path|
response.should redirect_to(path)
end
However, I'm getting a
Spec::Expectations::ExpectationNotMetError: expected redirect to "/",
got no redirect
So the user is definitely being created in the test database, but the
login doesn't seem to work, or to do the redirect.
I must be doing something silly. If anyone could point me in the right
direction, I'd be very grateful.
Thanks very much,
Steven
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users