Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Levi's solution #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ Feature: Login Page

Scenario: Authenticated User
Given the login page
When I log in with proper credentials
Then I should see the secret page

When I login with username and password lklingler
Then I should see the secret page with username lklingler shown
10 changes: 9 additions & 1 deletion features/logout.feature
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#Add your codez here
Feature: Logout Page
In order to keep out the bad guys
As a user
I want to be able to logout after I am done using the secret page

Scenario: Authenticated User
Given the secret page reached via credentials of lklingler
When I click Logout
Then I should see the login page with the message "You have been logged out" shown
15 changes: 7 additions & 8 deletions features/step_definitions/login_steps.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Given(/^the login page$/) do
#put your code here
pending
visit 'http://localhost:4567/'
end

When(/^I log in with proper credentials$/) do
#put your code here
pending
When(/^I login with username and password (.*?)$/) do |credentials|
fill_in 'username', :with => credentials
fill_in 'password', :with => credentials
click_button 'Login'
end

Then(/^I should see the secret page$/) do
#put your code here
pending
Then(/^I should see the secret page with username (.*?) shown$/) do |credentials|
page.should have_content(credentials)
end
14 changes: 13 additions & 1 deletion features/step_definitions/logout_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#Add your codez here
Given(/^the secret page reached via credentials of (.*?)$/) do |credentials|
step 'the login page'
step 'I login with username and password #{credentials}'
step 'I should see the secret page with username #{credentials} shown'
end

When(/^I click Logout$/) do
click_link 'Logout'
end

Then(/^I should see the login page with the message "(.*?)" shown$/) do |message|
page.should have_content(message)
end