fridge 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 291594eb2a2800f68ef6c4184f5b97ef14edd242
4
- data.tar.gz: 8f0c835ff0b772d81730c95e7b6c6c9bf21eb365
3
+ metadata.gz: baa2d0014ae145e09c68dc53c816938ad272aa3d
4
+ data.tar.gz: 7f34e028cb347f9da11e1d52d6f7443dc7f470bb
5
5
  SHA512:
6
- metadata.gz: 9314a498972e9c96182072df02c09a66d23e57bd9edcebb8ee3bc9f30fc1d5dba6f888935ae5772a7a860e354851263e405b82808e72aaf4213c1f8703d56a40
7
- data.tar.gz: a69f2d3255c868d2582e6b41d7a7b9a3c7ab38c987934f65234c9799222cd412e09cf5be9106e601aff2e822fe84f99c5e9a8a6462765419848d8e112e3ec2a2
6
+ metadata.gz: 586f9c3edb3356d64068ca3b9c43741411238423b6cdb0d6a63041fed790b13e47c3d1d43c7ea6ef1c4e290b04f03cf253e4a6da40a2d0d9a89b01d72cb866fa
7
+ data.tar.gz: 7d3dff29fffe39c8f656180e091639f4b2139a513fa024e2d0d189f5436cb4d39f2dacab4867987e57e781380359a3281e3d61fee5db8fe5a8fff723bc68ed91
@@ -82,12 +82,12 @@ module Fridge
82
82
  nil
83
83
  end
84
84
 
85
- def write_shared_cookie(name, value)
85
+ def write_shared_cookie(name, value, options = {})
86
86
  fail 'Can only write string cookie values' unless value.is_a?(String)
87
87
 
88
88
  cookies[name] = {
89
89
  value: value,
90
- expires: 1.year.from_now
90
+ expires: options[:expires] || 1.year.from_now
91
91
  }.merge(fridge_cookie_options)
92
92
  end
93
93
 
@@ -100,6 +100,10 @@ module Fridge
100
100
  write_shared_cookie(block.call)
101
101
  end
102
102
 
103
+ def delete_shared_cookie(name)
104
+ cookies.delete name, fridge_cookie_options.slice(:domain)
105
+ end
106
+
103
107
  def fridge_cookie_name
104
108
  Fridge.configuration.cookie_name
105
109
  end
@@ -1,3 +1,3 @@
1
1
  module Fridge
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -6,6 +6,9 @@ require 'rspec/rails'
6
6
  # http://say26.com/rspec-testing-controllers-outside-of-a-rails-application
7
7
  describe Controller, type: :controller do
8
8
  context Fridge::RailsHelpers do
9
+ let(:organization_url) do
10
+ "https://auth.aptible.com/users/#{SecureRandom.uuid}"
11
+ end
9
12
  let(:private_key) { OpenSSL::PKey::RSA.new(1024) }
10
13
  let(:public_key) { OpenSSL::PKey::RSA.new(private_key.public_key) }
11
14
 
@@ -159,6 +162,34 @@ describe Controller, type: :controller do
159
162
  end
160
163
  end
161
164
 
165
+ describe '#write_shared_cookie' do
166
+ before { Rails.stub_chain(:env, :development?) { false } }
167
+
168
+ it 'should save cookie' do
169
+ controller.write_shared_cookie(:organization_url, organization_url)
170
+ expect(cookies[:organization_url]).to eq organization_url
171
+ end
172
+ end
173
+
174
+ describe '#read_shared_cookie' do
175
+ it 'should read cookie' do
176
+ cookies[:organization_url] = { value: organization_url }
177
+ expect(controller.read_shared_cookie(:organization_url)).to(
178
+ eq organization_url
179
+ )
180
+ end
181
+ end
182
+
183
+ describe '#delete_shared_cookie' do
184
+ before { Rails.stub_chain(:env, :development?) { false } }
185
+
186
+ it 'should delete cookie' do
187
+ controller.write_shared_cookie(:organization_url, organization_url)
188
+ controller.delete_shared_cookie(:organization_url)
189
+ expect(cookies[:organization_url]).to be_nil
190
+ end
191
+ end
192
+
162
193
  describe '#fridge_cookie_options' do
163
194
  before { Rails.stub_chain(:env, :development?) { false } }
164
195
 
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-07 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jwt
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.1.13
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.1.13
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: aptible-tasks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '2.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: Token validation for distributed resource servers
@@ -143,9 +143,9 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - ".gitignore"
147
- - ".rspec"
148
- - ".travis.yml"
146
+ - .gitignore
147
+ - .rspec
148
+ - .travis.yml
149
149
  - Gemfile
150
150
  - LICENSE.md
151
151
  - README.md
@@ -173,12 +173,12 @@ require_paths:
173
173
  - lib
174
174
  required_ruby_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - ">="
176
+ - - '>='
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ">="
181
+ - - '>='
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []