diff --git a/features/login.feature b/features/login.feature index 3fff7cf..c482c06 100644 --- a/features/login.feature +++ b/features/login.feature @@ -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 diff --git a/features/logout.feature b/features/logout.feature index 251c445..c715327 100644 --- a/features/logout.feature +++ b/features/logout.feature @@ -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 diff --git a/features/step_definitions/login_steps.rb b/features/step_definitions/login_steps.rb index 61f803a..db69c74 100644 --- a/features/step_definitions/login_steps.rb +++ b/features/step_definitions/login_steps.rb @@ -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 diff --git a/features/step_definitions/logout_steps.rb b/features/step_definitions/logout_steps.rb index 251c445..759af3a 100644 --- a/features/step_definitions/logout_steps.rb +++ b/features/step_definitions/logout_steps.rb @@ -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