show_me_the_cookies 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/README.md +66 -46
- data/Rakefile +1 -2
- data/lib/show_me_the_cookies/version.rb +1 -1
- data/show_me_the_cookies.gemspec +1 -0
- metadata +23 -9
- data/VERSION +0 -1
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -10,79 +10,99 @@ Rails session cookies look something like '\_appname\_session', and can be found
|
|
10
10
|
Credits and Acknowledgements
|
11
11
|
==================================
|
12
12
|
|
13
|
-
Initial release as a gist [here](https://gist.github.com/484787), early development sponsored by [Medify](www.medify.co.uk).
|
13
|
+
Initial release as a gist [here](https://gist.github.com/484787), early development sponsored by [Medify](http://www.medify.co.uk).
|
14
14
|
|
15
15
|
Contributions have been made by:
|
16
16
|
|
17
17
|
* [Leandro Pedroni](https://github.com/ilpoldo) -- Rails 3 session cookie detection (no longer in the code but present in readme)
|
18
18
|
* [Matthew Nielsen](https://github.com/xunker) -- added culerity support & encouraged gem release
|
19
19
|
|
20
|
+
gem install
|
21
|
+
-----------
|
22
|
+
gem install show\_me\_the\_cookies, or whatever fits your situation.
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
RSpec
|
25
|
+
=====
|
26
|
+
|
27
|
+
in step_helper or your support directory:
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
config.include ShowMeTheCookies, :type => :request
|
31
|
+
end
|
32
|
+
|
33
|
+
Example usage
|
34
|
+
--------------
|
35
|
+
|
36
|
+
|
37
|
+
it "remember-me is on by default" do
|
38
|
+
member = Member.make
|
39
|
+
visit dashboard_path
|
40
|
+
page.should have_content "Login"
|
41
|
+
within '#member_login' do
|
42
|
+
fill_in "Email", :with => member.email
|
43
|
+
fill_in "Password", :with => member.password
|
44
|
+
click_on "Sign in"
|
45
|
+
end
|
46
|
+
|
47
|
+
page.should have_content("Dashboard")
|
48
|
+
page.should have_no_content("Login")
|
49
|
+
# Given I close my browser (clearing the session)
|
50
|
+
delete_cookie Rails.application.config.session_options[:key]
|
51
|
+
|
52
|
+
# When I come back next time
|
53
|
+
visit dashboard_path
|
54
|
+
page.should have_content("Dashboard")
|
55
|
+
page.should have_no_content("Login")
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
Cucumber
|
60
|
+
========
|
61
|
+
|
62
|
+
Install by loading the gem and adding the following to your stepdefs or support files
|
63
|
+
|
64
|
+
World(ShowMeTheCookies)
|
65
|
+
Before('@announce') do
|
66
|
+
@announce = true
|
67
|
+
end
|
23
68
|
|
24
|
-
|
25
|
-
|
69
|
+
Example Usage
|
70
|
+
-------------
|
26
71
|
|
27
72
|
@javascript @announce
|
28
73
|
Scenario: remembering users so they don't have to log in again for a while
|
29
|
-
Given
|
74
|
+
Given I am a site member
|
30
75
|
When I go to the dashboard
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
And I
|
36
|
-
Then I should
|
37
|
-
And I should see "Logged in as Paul Smith"
|
38
|
-
And I should see "Sign out"
|
39
|
-
|
40
|
-
Given I close my browser (clearing the Medify session)
|
41
|
-
When I come back next time
|
42
|
-
And I go to the dashboard
|
43
|
-
Then I should see "Logged in as Paul Smith"
|
44
|
-
And I should see "Sign out"
|
76
|
+
And I log in with the Remember Me option checked
|
77
|
+
Then I should see "Welcome back"
|
78
|
+
|
79
|
+
When I close my browser (clearing the session)
|
80
|
+
And I return to the dashboard url
|
81
|
+
Then I should see "Welcome back"
|
45
82
|
|
46
83
|
@rack_test @announce
|
47
84
|
Scenario: don't remember users across browser restarts if they don't want it
|
48
|
-
Given
|
85
|
+
Given I am a site member
|
49
86
|
When I go to the dashboard
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
And I
|
55
|
-
Then I should
|
56
|
-
And I should see "Logged in as Paul Smith"
|
57
|
-
And I should see "Sign out"
|
58
|
-
|
59
|
-
Given I close my browser (clearing the Medify session)
|
60
|
-
When I come back next time
|
61
|
-
And I go to the dashboard
|
62
|
-
Then I should see "Existing Member Login"
|
63
|
-
And I should not see "Logged in as Paul Smith"
|
64
|
-
And I should not see "Sign out"
|
87
|
+
And I log in without the Remember Me option checked
|
88
|
+
Then I should see "Welcome back"
|
89
|
+
|
90
|
+
When I close my browser (clearing the session)
|
91
|
+
And I return to the dashboard url
|
92
|
+
Then I should see the log-in screen
|
65
93
|
|
66
|
-
gem install
|
67
|
-
-----------
|
68
|
-
gem install show\_me\_the\_cookies, or whatever fits your situation.
|
69
94
|
|
70
95
|
stepdef file
|
71
96
|
------------
|
72
97
|
|
73
|
-
|
98
|
+
for example cookie_steps.rb
|
74
99
|
|
75
100
|
Then /^show me the cookies!$/ do
|
76
101
|
show_me_the_cookies
|
77
102
|
end
|
78
103
|
|
79
104
|
Given /^I close my browser \(clearing the Medify session\)$/ do
|
80
|
-
delete_cookie '
|
81
|
-
end
|
82
|
-
|
83
|
-
World(ShowMeTheCookies)
|
84
|
-
Before('@announce') do
|
85
|
-
@announce = true
|
105
|
+
delete_cookie '_appname_session' # or in rails 3 use Rails.application.config.session_options[:key]
|
86
106
|
end
|
87
107
|
|
88
108
|
Contributing
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
1
|
+
require 'bundler/gem_tasks'
|
data/show_me_the_cookies.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: show_me_the_cookies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nicholas Rutherford
|
@@ -15,10 +15,25 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-28 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: capybara
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
22
37
|
description: Cookie manipulation for Capybara drivers -- viewing, deleting, ...
|
23
38
|
email:
|
24
39
|
- nick.rutherford@gmail.com
|
@@ -36,7 +51,6 @@ files:
|
|
36
51
|
- LICENSE.txt
|
37
52
|
- README.md
|
38
53
|
- Rakefile
|
39
|
-
- VERSION
|
40
54
|
- lib/show_me_the_cookies.rb
|
41
55
|
- lib/show_me_the_cookies/culerity.rb
|
42
56
|
- lib/show_me_the_cookies/rack_test.rb
|
@@ -73,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
87
|
requirements: []
|
74
88
|
|
75
89
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.6.2
|
77
91
|
signing_key:
|
78
92
|
specification_version: 3
|
79
93
|
summary: Cookie manipulation for Capybara drivers
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.0
|