safe_cookies 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module SafeCookies
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/lib/safe_cookies.rb CHANGED
@@ -74,6 +74,7 @@ module SafeCookies
74
74
 
75
75
  def set_secure_cookie!(headers, key, value, expire_after = 365 * 24 * 60 * 60) # one year
76
76
  options = {
77
+ :path => '/',
77
78
  :value => value,
78
79
  :secure => secure?(key),
79
80
  :httponly => http_only?(key),
@@ -119,4 +119,18 @@ describe SafeCookies::Middleware do
119
119
  options[:non_http_only].should == [:cookie3]
120
120
  end
121
121
 
122
+ it 'sets cookies on the root path (if no "path" is supplied, browsers assume the current)' do
123
+ subject = described_class.new(app, :my_old_cookie => 3600)
124
+ env['HTTP_COOKIE'] = 'my_old_cookie=foobar'
125
+ app.should_receive(:call).and_return([ stub, {}, stub ])
126
+
127
+ code, headers, response = subject.call(env)
128
+
129
+ cookies = headers['Set-Cookie'].split("\n")
130
+ cookies.size.should > 0
131
+ cookies.each do |cookie|
132
+ cookie.should include('; path=/;')
133
+ end
134
+ end
135
+
122
136
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe_cookies
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Dominik Sch\xC3\xB6ler"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-08-26 00:00:00 +02:00
18
+ date: 2013-08-27 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency