Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Login Feature
- Feature: Login
- In order to use monqi 2.0
- As an user
- I want to login
- Background:
- Given the default settings
- And the default Roles
- Scenario: Member login
- Given I am on the home page
- And No user is logged in
- And I am a "member"
- Then I should not see "log out"
- When I fill in "login_input" with "bobby"
- And I fill in "password_input" with "secret"
- And I press "login"
- Then I should see "Login successful!"
- Scenario: Show edit link as admin
- Given the default Roles
- And the following user records
- | login | password | role |
- | bob | secret | "admin" |
- | lyn | secret | "manager" |
- | ami | secret | "staff" |
- | Niko | secret | "instructor" |
- | Cait | secret | "member" |
- And I am logged in as "admin" with password "secret"
- When I visit profile for "bob"
- Then I should see "Edit Profile"
- ## Login Steps
- Given /^the default Roles$/ do
- Role.create({:id => 1, :title => "admin"})
- Role.create({:id => 2, :title => "manager"})
- Role.create({:id => 3, :title => "staff_member"})
- Role.create({:id => 4, :title => "instructor"})
- Role.create({:id => 5, :title => "member"})
- Role.create({:id => 6, :title => "developer"})
- end
- def create_user(hash)
- @user = User.make(:login => hash[:login], :password => hash[:password], :password_confirmation => hash[:password])
- @role = Role.find_by_title(hash[:role])
- @user.person.roles << @role
- @user.save!
- end
- Given /^No user is logged in$/ do
- UserSession.find.nil?
- end
- Given /^I am a "([^\"]*)"$/ do |role|
- hash = {:login => "bobby", :password => "secret", :password_confirmation => "secret", :role => role}
- create_user(hash)
- end
- And /^the following user records$/ do |table|
- table.hashes.each do |hash|
- create_user(hash)
- end
- end
- ## Cucumber failure:
- Ami:mor Innovia$ cucumber features/login.feature
- Feature: Login
- In order to use monqi 2.0
- As an user
- I want to login
- Background: # features/login.feature:6
- Given the default settings # features/step_definitions/webrat_steps.rb:6
- And the default Roles # features/step_definitions/webrat_steps.rb:10
- Scenario: Member login # features/login.feature:10
- Given I am on the home page # features/step_definitions/webrat_steps.rb:19
- And No user is logged in # features/step_definitions/login_steps.rb:9
- And I am a "member" # features/step_definitions/login_steps.rb:13
- Then I should not see "log out" # features/step_definitions/webrat_steps.rb:114
- When I fill in "login_input" with "bobby" # features/step_definitions/webrat_steps.rb:39
- And I fill in "password_input" with "secret" # features/step_definitions/webrat_steps.rb:39
- And I press "login" # features/step_definitions/webrat_steps.rb:27
- Then I should see "Login successful!" # features/step_definitions/webrat_steps.rb:110
- Scenario: Show edit link as admin # features/login.feature:21
- Given the default Roles # features/step_definitions/webrat_steps.rb:10
- And the following user records # features/step_definitions/login_steps.rb:18
- | login | password | role |
- | bob | secret | "admin" |
- | lyn | secret | "manager" |
- | ami | secret | "staff" |
- | Niko | secret | "instructor" |
- | Cait | secret | "member" |
- Role(#24539910) expected, got NilClass(#1889530) (ActiveRecord::AssociationTypeMismatch)
- /Users/Innovia/Sites/mor/features/step_definitions/login_steps.rb:4:in `create_user'
- /Users/Innovia/Sites/mor/features/step_definitions/login_steps.rb:19:in `block (2 levels) in <top (required)>'
- /Users/Innovia/Sites/mor/features/step_definitions/login_steps.rb:18:in `each'
- /Users/Innovia/Sites/mor/features/step_definitions/login_steps.rb:18:in `/^the following user records$/'
- features/login.feature:23:in `And the following user records'
- And I am logged in as "admin" with password "secret" # features/step_definitions/login_steps.rb:24
- When I visit profile for "bob" # features/step_definitions/login_steps.rb:28
- Then I should see "Edit Profile" # features/step_definitions/webrat_steps.rb:110
- 2 scenarios (1 failed, 1 passed)
- 17 steps (1 failed, 3 skipped, 13 passed)
Add Comment
Please, Sign In to add comment