show_me_the_cookies 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ Show me the cookies
2
+ ===================
3
+
4
+ Some helpers for cucumber stepdefs (or other situations) where you want to find out what is going on with your browser cookies.
5
+
6
+ Original development took place when testing Devise 0.1's "Remember me" functionality under rails 2.3.x with capybara rack-test and/or selenium.
7
+
8
+ Rails session cookies look something like '\_appname\_session', and can be found with browser resource tracker (e.g. firebug) or using rails 3's Rails.application.config.session_options[:key]
9
+
10
+ Credits and Acknowledgements
11
+ ==================================
12
+
13
+ Initial release as a gist [here](https://gist.github.com/484787), early development sponsored by [Medify](www.medify.co.uk).
14
+
15
+ Contributions have been made by:
16
+
17
+ * [Leandro Pedroni](https://github.com/ilpoldo) -- Rails 3 session cookie detection (no longer in the code but present in readme)
18
+ * [Matthew Nielsen](https://github.com/xunker) -- added culerity support & encouraged gem release
19
+
20
+
21
+ Example Usage
22
+ =============
23
+
24
+ Feature
25
+ -------
26
+
27
+ @javascript @announce
28
+ Scenario: remembering users so they don't have to log in again for a while
29
+ Given an activated member exists with forename: "Paul", surname: "Smith", email: "paul_smith_91@gmail.com", password: "bananabanana"
30
+ When I go to the dashboard
31
+ Then I should see "Existing Member Login"
32
+ When I fill in "Email" with "paul_smith_91@gmail.com" within "#member_login"
33
+ And I fill in "Password" with "bananabanana" within "#member_login"
34
+ And I check "Remember me"
35
+ And I press "Sign in"
36
+ Then I should be on the dashboard
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"
45
+
46
+ @rack_test @announce
47
+ Scenario: don't remember users across browser restarts if they don't want it
48
+ Given an activated member exists with forename: "Paul", surname: "Smith", email: "paul_smith_91@gmail.com", password: "bananabanana"
49
+ When I go to the dashboard
50
+ Then I should see "Existing Member Login"
51
+ When I fill in "Email" with "paul_smith_91@gmail.com" within "#member_login"
52
+ And I fill in "Password" with "bananabanana" within "#member_login"
53
+ And I uncheck "Remember me"
54
+ And I press "Sign in"
55
+ Then I should be on the dashboard
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"
65
+
66
+ gem install
67
+ -----------
68
+ gem install show\_me\_the\_cookies, or whatever fits your situation.
69
+
70
+ stepdef file
71
+ ------------
72
+
73
+ call it whatever you like, mine is called cookie_steps.rb
74
+
75
+ Then /^show me the cookies!$/ do
76
+ show_me_the_cookies
77
+ end
78
+
79
+ Given /^I close my browser \(clearing the Medify session\)$/ do
80
+ delete_cookie '_medify_session' # or in rails 3 use Rails.application.config.session_options[:key]
81
+ end
82
+
83
+ World(ShowMeTheCookies)
84
+ Before('@announce') do
85
+ @announce = true
86
+ end
87
+
88
+ Contributing
89
+ ============
90
+
91
+ Code-style comments, refactoring, tests and new features welcome (roughly in that order :).
92
+
93
+ When sending changes:
94
+
95
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
96
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
97
+ * Fork the project
98
+ * Start a feature/bugfix branch
99
+ * Commit and push until you are happy with your contribution
100
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
101
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
102
+
103
+ Copyright
104
+ ============
105
+ Copyright (c) 2011 Nicholas Rutherford. See LICENSE.txt for
106
+ further details.
107
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -17,10 +17,6 @@ module ShowMeTheCookies
17
17
  end
18
18
  end
19
19
 
20
- def self.session_cookie_name=(name)
21
- @@session_cookie_name = name
22
- end
23
-
24
20
  def show_me_the_cookies
25
21
  announce "Current cookies: #{current_driver_adapter.show_me_the_cookies}"
26
22
  end
@@ -38,15 +34,4 @@ private
38
34
  def self.unsupported_browser_spam
39
35
  raise "unsupported driver, use rack::test, selenium/webdriver or culerity"
40
36
  end
41
-
42
- # Rails.application.config.session_options[:key] #for rails 3, courtesy of https://github.com/ilpoldo
43
- #else just hard code it as follows
44
- #'_appname_session' #or check in browser for what your app is using
45
- def session_cookie_name
46
- begin
47
- @@session_cookie_name || Rails.application.config.session_options[:key]
48
- rescue NoMethodError => e
49
- raise "set ShowMeTheCookies.session_cookie_name= for your rails 2 app"
50
- end
51
- end
52
37
  end
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{show_me_the_cookies}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Nicholas Rutherford"]
12
+ s.date = %q{2011-01-07}
13
+ s.description = %q{Cookie manipulation for Capybara drivers -- viewing, deleting, ...}
14
+ s.email = %q{nick.rutherford@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "features/show_me_the_cookies.feature",
28
+ "features/step_definitions/show_me_the_cookies_steps.rb",
29
+ "features/support/env.rb",
30
+ "lib/show_me_the_cookies.rb",
31
+ "lib/show_me_the_cookies/culerity.rb",
32
+ "lib/show_me_the_cookies/rack_test.rb",
33
+ "lib/show_me_the_cookies/selenium.rb",
34
+ "show_me_the_cookies.gemspec"
35
+ ]
36
+ s.homepage = %q{http://github.com/nruth/show_me_the_cookies}
37
+ s.licenses = ["MIT"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.4.2}
40
+ s.summary = %q{Cookie manipulation for Capybara drivers}
41
+
42
+ if s.respond_to? :specification_version then
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
47
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
49
+ else
50
+ s.add_dependency(%q<cucumber>, [">= 0"])
51
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
52
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<cucumber>, [">= 0"])
56
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
58
+ end
59
+ end
60
+
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: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nicholas Rutherford
@@ -72,13 +72,13 @@ extensions: []
72
72
 
73
73
  extra_rdoc_files:
74
74
  - LICENSE.txt
75
- - README.rdoc
75
+ - README.md
76
76
  files:
77
77
  - .document
78
78
  - .rspec
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
- - README.rdoc
81
+ - README.md
82
82
  - Rakefile
83
83
  - VERSION
84
84
  - features/show_me_the_cookies.feature
@@ -88,6 +88,7 @@ files:
88
88
  - lib/show_me_the_cookies/culerity.rb
89
89
  - lib/show_me_the_cookies/rack_test.rb
90
90
  - lib/show_me_the_cookies/selenium.rb
91
+ - show_me_the_cookies.gemspec
91
92
  has_rdoc: true
92
93
  homepage: http://github.com/nruth/show_me_the_cookies
93
94
  licenses:
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = show_me_the_cookies
2
-
3
- Description goes here.
4
-
5
- == Contributing to show_me_the_cookies
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 Nicholas Rutherford. See LICENSE.txt for
18
- further details.
19
-