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

adding login_steps #30

Open
wants to merge 2 commits 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
25 changes: 25 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ GEM
extlib (0.9.16)
gherkin (2.12.2)
multi_json (~> 1.3)
gherkin (2.12.2-x86-mingw32)
multi_json (~> 1.3)
haml (4.0.6)
tilt
highline (1.6.21)
Expand All @@ -31,19 +33,35 @@ GEM
multi_test (0.1.1)
nokogiri (1.6.4.1)
mini_portile (~> 0.6.0)
nokogiri (1.6.4.1-x86-mingw32)
mini_portile (~> 0.6.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry (0.10.1-x86-mingw32)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
win32console (~> 1.3)
rack (1.5.2)
rack-protection (1.5.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
sass (3.4.23)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
Expand All @@ -54,17 +72,24 @@ GEM
extlib (>= 0.9.5)
highline (>= 1.4.0)
tilt (1.4.1)
win32console (1.3.2-x86-mingw32)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
capybara
cucumber
cucumber-sinatra
haml
pry
rspec
rspec-expectations
sass
sinatra

BUNDLED WITH
1.13.7
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 my privacy
As a user
I want to have to logout to keep my page secure

Scenario: Log out User
Given I am on the secret page
When I click the logout button
Then I should return to the login page
11 changes: 5 additions & 6 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 '/'
end

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

Then(/^I should see the secret page$/) do
#put your code here
pending
expect(current_path).to eq '/dashboard'
end
20 changes: 19 additions & 1 deletion features/step_definitions/logout_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
#Add your codez here
Given /^(.*) is logged in$/ do |name|
steps %Q{
Given the user #{name} exists
Given I log in as #{name}
}
end

When(/^I am on the secret page$/) do
visit '/dashboard'
end

When(/^I click the logout button$/) do
url = URI.parse(current_url)
expect(url).to assert_current_path("http://localhost:4567/logout", url: true )
end

Then(/^I should return to the login page$/) do
expect(page).to have_content('You have been logged out.')
end