Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.dirname(__FILE__) + "/helper"
- def login_user
- post "/sessions", :login => @user.login, :password => "test"
- @login_response = response
- end
- def create_user(login = "some_user")
- user = User.create!(:login => login, :password => 'test', :password_confirmation => 'test', :email => "#{login}@test.com")
- user.activate
- user
- end
- steps_for(:simple_user) do
- Given "a user" do
- @user = create_user("user_ursula")
- end
- When "the user logs in" do
- login_user
- end
- Then "the login should be successful" do
- response.should be_success
- end
- end
- with_steps_for(:simple_user) do
- run_local_story "simple", :type => RailsStory
- end
- ### simple is below:
- Story: User logging in
- As a user
- I want to login with my details
- So that I can get access to the site
- Scenario: User is valid
- Given a user
- When the user logs in
- Then the login should be successful
- ### output:
- $ ruby stories/simple.rb
- Running 1 scenarios
- Story: User logging in
- As a user
- I want to login with my details
- So that I can get access to the site
- Scenario: User is valid
- Given a user
- When the user logs in
- Then the login should be successful (FAILED)
- 1 scenarios: 0 succeeded, 1 failed, 0 pending
- FAILURES:
- 1) User logging in (User is valid) FAILED
- Spec::Expectations::ExpectationNotMetError: expected success? to return true, got false
- vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/expectations.rb:52:in `fail_with'
- ...
Add Comment
Please, Sign In to add comment