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

finished challenge #45

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
22 changes: 22 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GEM
templater (>= 1.0.0)
diff-lcs (1.2.5)
extlib (0.9.16)
ffi (1.9.23)
gherkin (2.12.2)
multi_json (~> 1.3)
haml (4.0.6)
Expand All @@ -40,10 +41,26 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
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.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
Expand All @@ -66,5 +83,10 @@ DEPENDENCIES
cucumber-sinatra
haml
pry
rspec
rspec-expectations
sass
sinatra

BUNDLED WITH
1.16.1
11 changes: 10 additions & 1 deletion features/logout.feature
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
#Add your codez here
Feature: Logout Page
In order to keep out the bad guys
As a user
I want to have leave my private page when I logout

Scenario: Logged-in User
Given the secret page
When I log out
Then I should not see the secret page

16 changes: 9 additions & 7 deletions features/step_definitions/login_steps.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Given(/^the login page$/) do
#put your code here
pending
visit '/'
expect(page.body).to include("Capybara Secret Site")
end

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

Then(/^I should see the secret page$/) do
#put your code here
pending
end
expect(page.body).to include("This is the secret page.")
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(/^the secret page$/) do
visit '/'
expect(page.body).to include("Capybara Secret Site")
within("#session") do
fill_in 'username', with: 'example'
fill_in 'password', with: 'example'
end
click_button 'Login'
expect(page.body).to include("This is the secret page.")
end

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

Then(/^I should not see the secret page$/) do
expect(page.body).not_to include("This is the secret page.")
expect(page.body).to include("This is login page for users.")
end