omniauth 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of omniauth might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.yardopts +4 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +41 -27
- data/lib/omniauth.rb +1 -1
- data/lib/omniauth/form.rb +1 -1
- data/lib/omniauth/strategies/developer.rb +1 -1
- data/lib/omniauth/strategy.rb +4 -4
- data/lib/omniauth/test/strategy_macros.rb +8 -8
- data/lib/omniauth/version.rb +1 -1
- data/omniauth.gemspec +24 -25
- data/spec/omniauth/auth_hash_spec.rb +38 -38
- data/spec/omniauth/builder_spec.rb +12 -10
- data/spec/omniauth/failure_endpoint_spec.rb +13 -13
- data/spec/omniauth/form_spec.rb +10 -10
- data/spec/omniauth/strategies/developer_spec.rb +21 -21
- data/spec/omniauth/strategy_spec.rb +236 -228
- data/spec/omniauth_spec.rb +40 -40
- data/spec/spec_helper.rb +3 -0
- metadata +41 -101
- metadata.gz.sig +0 -0
- data/Gemfile +0 -17
- data/Gemfile.rack-1.3.x +0 -4
- data/Guardfile +0 -10
@@ -3,19 +3,19 @@ require 'spec_helper'
|
|
3
3
|
describe OmniAuth::FailureEndpoint do
|
4
4
|
subject{ OmniAuth::FailureEndpoint }
|
5
5
|
|
6
|
-
context
|
6
|
+
context "development" do
|
7
7
|
before do
|
8
8
|
@rack_env = ENV['RACK_ENV']
|
9
9
|
ENV['RACK_ENV'] = 'development'
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
12
|
+
it "raises out the error" do
|
13
13
|
expect do
|
14
14
|
subject.call('omniauth.error' => StandardError.new("Blah"))
|
15
15
|
end.to raise_error(StandardError, "Blah")
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
18
|
+
it "raises out an OmniAuth::Error if no omniauth.error is set" do
|
19
19
|
expect{ subject.call('omniauth.error.type' => 'example') }.to raise_error(OmniAuth::Error, "example")
|
20
20
|
end
|
21
21
|
|
@@ -24,30 +24,30 @@ describe OmniAuth::FailureEndpoint do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
27
|
+
context "non-development" do
|
28
28
|
let(:env){ {'omniauth.error.type' => 'invalid_request',
|
29
29
|
'omniauth.error.strategy' => ExampleStrategy.new({}) } }
|
30
30
|
|
31
|
-
it
|
31
|
+
it "is a redirect" do
|
32
32
|
status, head, body = *subject.call(env)
|
33
|
-
status.
|
33
|
+
expect(status).to eq(302)
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
36
|
+
it "includes the SCRIPT_NAME" do
|
37
37
|
status, head, body = *subject.call(env.merge('SCRIPT_NAME' => '/random'))
|
38
|
-
head['Location'].
|
38
|
+
expect(head['Location']).to eq('/random/auth/failure?message=invalid_request&strategy=test')
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
41
|
+
it "respects the configured path prefix" do
|
42
42
|
OmniAuth.config.stub(:path_prefix => '/boo')
|
43
43
|
status, head, body = *subject.call(env)
|
44
|
-
head["Location"].
|
44
|
+
expect(head["Location"]).to eq('/boo/failure?message=invalid_request&strategy=test')
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
47
|
+
it "includes the origin (escaped) if one is provided" do
|
48
48
|
env.merge! 'omniauth.origin' => '/origin-example'
|
49
49
|
status, head, body = *subject.call(env)
|
50
|
-
head['Location'].
|
50
|
+
expect(head['Location']).to be_include('&origin=%2Forigin-example')
|
51
51
|
end
|
52
52
|
end
|
53
|
-
end
|
53
|
+
end
|
data/spec/omniauth/form_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe OmniAuth::Form do
|
4
|
-
describe
|
5
|
-
it
|
6
|
-
OmniAuth::Form.build{|f| f.
|
4
|
+
describe ".build" do
|
5
|
+
it "yields the instance when called with a block and argument" do
|
6
|
+
OmniAuth::Form.build{|f| expect(f).to be_kind_of(OmniAuth::Form)}
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
10
|
-
OmniAuth::Form.build{
|
9
|
+
it "evaluates in the instance when called with a block and no argument" do
|
10
|
+
OmniAuth::Form.build{|f| expect(f.class).to eq(OmniAuth::Form)}
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe
|
15
|
-
it
|
16
|
-
OmniAuth::Form.new(:url => '/awesome').to_html.
|
14
|
+
describe "#initialize" do
|
15
|
+
it "sets the form action to the passed :url option" do
|
16
|
+
expect(OmniAuth::Form.new(:url => '/awesome').to_html).to be_include("action='/awesome'")
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
OmniAuth::Form.new(:title => 'Something Cool').to_html.
|
19
|
+
it "sets an H1 tag from the passed :title option" do
|
20
|
+
expect(OmniAuth::Form.new(:title => 'Something Cool').to_html).to be_include('<h1>Something Cool</h1>')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -7,45 +7,45 @@ describe OmniAuth::Strategies::Developer do
|
|
7
7
|
b.run lambda{|env| [200, {}, ['Not Found']]}
|
8
8
|
end.to_app }
|
9
9
|
|
10
|
-
context
|
10
|
+
context "request phase" do
|
11
11
|
before(:each){ get '/auth/developer' }
|
12
12
|
|
13
|
-
it
|
14
|
-
last_response.status.
|
15
|
-
last_response.body.
|
13
|
+
it "displays a form" do
|
14
|
+
expect(last_response.status).to eq(200)
|
15
|
+
expect(last_response.body).to be_include("<form")
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
19
|
-
last_response.body.
|
18
|
+
it "has the callback as the action for the form" do
|
19
|
+
expect(last_response.body).to be_include("action='/auth/developer/callback'")
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
last_response.body.scan('<input').size.
|
22
|
+
it "has a text field for each of the fields" do
|
23
|
+
expect(last_response.body.scan('<input').size).to eq(2)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
27
|
+
context "callback phase" do
|
28
28
|
let(:auth_hash){ last_request.env['omniauth.auth'] }
|
29
29
|
|
30
|
-
context
|
30
|
+
context "with default options" do
|
31
31
|
before do
|
32
32
|
post '/auth/developer/callback', :name => 'Example User', :email => 'user@example.com'
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
auth_hash.info.name.
|
35
|
+
it "sets the name in the auth hash" do
|
36
|
+
expect(auth_hash.info.name).to eq('Example User')
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
auth_hash.info.email.
|
39
|
+
it "sets the email in the auth hash" do
|
40
|
+
expect(auth_hash.info.email).to eq('user@example.com')
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
44
|
-
auth_hash.uid.
|
43
|
+
it "sets the uid to the email" do
|
44
|
+
expect(auth_hash.uid).to eq('user@example.com')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
context
|
48
|
+
context "with custom options" do
|
49
49
|
let(:app){ Rack::Builder.new do |b|
|
50
50
|
b.use Rack::Session::Cookie
|
51
51
|
b.use OmniAuth::Strategies::Developer, :fields => [:first_name, :last_name], :uid_field => :last_name
|
@@ -57,12 +57,12 @@ describe OmniAuth::Strategies::Developer do
|
|
57
57
|
post '/auth/developer/callback', :first_name => 'Example', :last_name => 'User'
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
61
|
-
auth_hash.info.name.
|
60
|
+
it "sets info fields properly" do
|
61
|
+
expect(auth_hash.info.name).to eq('Example User')
|
62
62
|
end
|
63
63
|
|
64
|
-
it
|
65
|
-
auth_hash.uid.
|
64
|
+
it "sets the uid properly" do
|
65
|
+
expect(auth_hash.uid).to eq('User')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -13,8 +13,8 @@ describe OmniAuth::Strategy do
|
|
13
13
|
let(:app){ lambda{|env| [404, {}, ['Awesome']]}}
|
14
14
|
let(:fresh_strategy){ c = Class.new; c.send :include, OmniAuth::Strategy; c}
|
15
15
|
|
16
|
-
describe
|
17
|
-
it
|
16
|
+
describe ".default_options" do
|
17
|
+
it "is inherited from a parent class" do
|
18
18
|
superklass = Class.new
|
19
19
|
superklass.send :include, OmniAuth::Strategy
|
20
20
|
superklass.configure do |c|
|
@@ -22,104 +22,110 @@ describe OmniAuth::Strategy do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
klass = Class.new(superklass)
|
25
|
-
klass.default_options.foo.
|
25
|
+
expect(klass.default_options.foo).to eq('bar')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe
|
29
|
+
describe ".configure" do
|
30
30
|
subject { klass = Class.new; klass.send :include, OmniAuth::Strategy; klass }
|
31
|
-
it
|
31
|
+
it "takes a block and allow for default options setting" do
|
32
32
|
subject.configure do |c|
|
33
33
|
c.wakka = 'doo'
|
34
34
|
end
|
35
|
-
subject.default_options["wakka"].
|
35
|
+
expect(subject.default_options["wakka"]).to eq("doo")
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
38
|
+
it "takes a hash and deep merge it" do
|
39
39
|
subject.configure :abc => {:def => 123}
|
40
40
|
subject.configure :abc => {:hgi => 456}
|
41
|
-
subject.default_options['abc'].
|
41
|
+
expect(subject.default_options['abc']).to eq({'def' => 123, 'hgi' => 456})
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
describe
|
46
|
-
it
|
47
|
-
ExampleStrategy.new(app, :skip_info => true).
|
45
|
+
describe "#skip_info?" do
|
46
|
+
it "is true if options.skip_info is true" do
|
47
|
+
expect(ExampleStrategy.new(app, :skip_info => true)).to be_skip_info
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
51
|
-
ExampleStrategy.new(app, :skip_info => false).
|
50
|
+
it "is false if options.skip_info is false" do
|
51
|
+
expect(ExampleStrategy.new(app, :skip_info => false)).not_to be_skip_info
|
52
52
|
end
|
53
53
|
|
54
|
-
it
|
55
|
-
ExampleStrategy.new(app).
|
54
|
+
it "is false by default" do
|
55
|
+
expect(ExampleStrategy.new(app)).not_to be_skip_info
|
56
56
|
end
|
57
57
|
|
58
|
-
it
|
58
|
+
it "is true if options.skip_info is a callable that evaluates to truthy" do
|
59
59
|
instance = ExampleStrategy.new(app, :skip_info => lambda{|uid| uid})
|
60
60
|
instance.should_receive(:uid).and_return(true)
|
61
|
-
instance.
|
61
|
+
expect(instance).to be_skip_info
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
describe
|
65
|
+
describe ".option" do
|
66
66
|
subject { klass = Class.new; klass.send :include, OmniAuth::Strategy; klass }
|
67
|
-
it
|
67
|
+
it "sets a default value" do
|
68
68
|
subject.option :abc, 123
|
69
|
-
subject.default_options.abc.
|
69
|
+
expect(subject.default_options.abc).to eq(123)
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
72
|
+
it "sets the default value to nil if none is provided" do
|
73
73
|
subject.option :abc
|
74
|
-
subject.default_options.abc.
|
74
|
+
expect(subject.default_options.abc).to be_nil
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
describe
|
78
|
+
describe ".args" do
|
79
79
|
subject{ c = Class.new; c.send :include, OmniAuth::Strategy; c }
|
80
|
-
it
|
80
|
+
it "sets args to the specified argument if there is one" do
|
81
81
|
subject.args [:abc, :def]
|
82
|
-
subject.args.
|
82
|
+
expect(subject.args).to eq([:abc, :def])
|
83
83
|
end
|
84
84
|
|
85
|
-
it
|
85
|
+
it "is inheritable" do
|
86
86
|
subject.args [:abc, :def]
|
87
87
|
c = Class.new(subject)
|
88
|
-
c.args.
|
88
|
+
expect(c.args).to eq([:abc, :def])
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
context
|
92
|
+
context "fetcher procs" do
|
93
93
|
subject{ fresh_strategy }
|
94
94
|
%w(uid info credentials extra).each do |fetcher|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
describe ".#{fetcher}" do
|
96
|
+
it "sets and retrieve a proc" do
|
97
|
+
proc = lambda{ "Hello" }
|
98
|
+
subject.send(fetcher, &proc)
|
99
|
+
expect(subject.send(fetcher)).to eq(proc)
|
100
|
+
end
|
99
101
|
end
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
|
-
context
|
105
|
+
context "fetcher stacks" do
|
104
106
|
subject{ fresh_strategy }
|
105
107
|
%w(uid info credentials extra).each do |fetcher|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
describe ".#{fetcher}_stack" do
|
109
|
+
it "is an array of called ancestral procs" do
|
110
|
+
fetchy = Proc.new{ "Hello" }
|
111
|
+
subject.send(fetcher, &fetchy)
|
112
|
+
expect(subject.send("#{fetcher}_stack", subject.new(app))).to eq(["Hello"])
|
113
|
+
end
|
110
114
|
end
|
111
115
|
end
|
112
116
|
end
|
113
117
|
|
114
118
|
%w(request_phase).each do |abstract_method|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
+
context "#{abstract_method}" do
|
120
|
+
it "raises a NotImplementedError" do
|
121
|
+
strat = Class.new
|
122
|
+
strat.send :include, OmniAuth::Strategy
|
123
|
+
expect{strat.new(app).send(abstract_method) }.to raise_error(NotImplementedError)
|
124
|
+
end
|
119
125
|
end
|
120
126
|
end
|
121
127
|
|
122
|
-
describe
|
128
|
+
describe "#auth_hash" do
|
123
129
|
subject do
|
124
130
|
klass = Class.new
|
125
131
|
klass.send :include, OmniAuth::Strategy
|
@@ -128,316 +134,318 @@ describe OmniAuth::Strategy do
|
|
128
134
|
end
|
129
135
|
let(:instance){ subject.new(app) }
|
130
136
|
|
131
|
-
it
|
137
|
+
it "calls through to uid and info" do
|
132
138
|
instance.should_receive :uid
|
133
139
|
instance.should_receive :info
|
134
140
|
instance.auth_hash
|
135
141
|
end
|
136
142
|
|
137
|
-
it
|
143
|
+
it "returns an AuthHash" do
|
138
144
|
instance.stub!(:uid).and_return('123')
|
139
145
|
instance.stub!(:info).and_return(:name => 'Hal Awesome')
|
140
146
|
hash = instance.auth_hash
|
141
|
-
hash.
|
142
|
-
hash.uid.
|
143
|
-
hash.info.name.
|
147
|
+
expect(hash).to be_kind_of(OmniAuth::AuthHash)
|
148
|
+
expect(hash.uid).to eq('123')
|
149
|
+
expect(hash.info.name).to eq('Hal Awesome')
|
144
150
|
end
|
145
151
|
end
|
146
152
|
|
147
|
-
describe
|
148
|
-
context
|
149
|
-
it
|
150
|
-
ExampleStrategy.new(app, :abc => 123).options[:abc].
|
153
|
+
describe "#initialize" do
|
154
|
+
context "options extraction" do
|
155
|
+
it "is the last argument if the last argument is a Hash" do
|
156
|
+
expect(ExampleStrategy.new(app, :abc => 123).options[:abc]).to eq(123)
|
151
157
|
end
|
152
158
|
|
153
|
-
it
|
159
|
+
it "is the default options if any are provided" do
|
154
160
|
ExampleStrategy.stub!(:default_options).and_return(OmniAuth::Strategy::Options.new(:abc => 123))
|
155
|
-
ExampleStrategy.new(app).options.abc.
|
161
|
+
expect(ExampleStrategy.new(app).options.abc).to eq(123)
|
156
162
|
end
|
157
163
|
end
|
158
164
|
|
159
|
-
context
|
165
|
+
context "custom args" do
|
160
166
|
subject{ c = Class.new; c.send :include, OmniAuth::Strategy; c }
|
161
|
-
it
|
167
|
+
it "sets options based on the arguments if they are supplied" do
|
162
168
|
subject.args [:abc, :def]
|
163
169
|
s = subject.new app, 123, 456
|
164
|
-
s.options[:abc].
|
165
|
-
s.options[:def].
|
170
|
+
expect(s.options[:abc]).to eq(123)
|
171
|
+
expect(s.options[:def]).to eq(456)
|
166
172
|
end
|
167
173
|
end
|
168
174
|
end
|
169
175
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
+
describe "#call" do
|
177
|
+
it "duplicates and calls" do
|
178
|
+
klass = Class.new
|
179
|
+
klass.send :include, OmniAuth::Strategy
|
180
|
+
instance = klass.new(app)
|
181
|
+
instance.should_receive(:dup).and_return(instance)
|
182
|
+
instance.call({'rack.session' => {}})
|
183
|
+
end
|
176
184
|
end
|
177
185
|
|
178
|
-
describe
|
179
|
-
it
|
180
|
-
ExampleStrategy.new(app).inspect.
|
186
|
+
describe "#inspect" do
|
187
|
+
it "returns the class name" do
|
188
|
+
expect(ExampleStrategy.new(app).inspect).to eq('#<ExampleStrategy>')
|
181
189
|
end
|
182
190
|
end
|
183
191
|
|
184
|
-
describe
|
185
|
-
it
|
192
|
+
describe "#redirect" do
|
193
|
+
it "uses javascript if :iframe is true" do
|
186
194
|
response = ExampleStrategy.new(app, :iframe => true).redirect("http://abc.com")
|
187
|
-
response.last.body.first.
|
195
|
+
expect(response.last.body.first).to be_include("top.location.href")
|
188
196
|
end
|
189
197
|
end
|
190
198
|
|
191
|
-
describe
|
199
|
+
describe "#callback_phase" do
|
192
200
|
subject{ k = Class.new; k.send :include, OmniAuth::Strategy; k.new(app) }
|
193
201
|
|
194
|
-
it
|
202
|
+
it "sets the auth hash" do
|
195
203
|
env = make_env
|
196
204
|
subject.stub!(:env).and_return(env)
|
197
205
|
subject.stub!(:auth_hash).and_return("AUTH HASH")
|
198
206
|
subject.callback_phase
|
199
|
-
env['omniauth.auth'].
|
207
|
+
expect(env['omniauth.auth']).to eq("AUTH HASH")
|
200
208
|
end
|
201
209
|
end
|
202
210
|
|
203
|
-
describe
|
211
|
+
describe "#full_host" do
|
204
212
|
let(:strategy){ ExampleStrategy.new(app, {}) }
|
205
|
-
it
|
213
|
+
it "remains calm when there is a pipe in the URL" do
|
206
214
|
strategy.call!(make_env('/whatever', 'rack.url_scheme' => 'http', 'SERVER_NAME' => 'facebook.lame', 'QUERY_STRING' => 'code=asofibasf|asoidnasd', 'SCRIPT_NAME' => '', 'SERVER_PORT' => 80))
|
207
|
-
|
215
|
+
expect{strategy.full_host }.not_to raise_error
|
208
216
|
end
|
209
217
|
end
|
210
218
|
|
211
|
-
describe
|
219
|
+
describe "#uid" do
|
212
220
|
subject{ fresh_strategy }
|
213
|
-
it "
|
221
|
+
it "is the current class's uid if one exists" do
|
214
222
|
subject.uid{ "Hi" }
|
215
|
-
subject.new(app).uid.
|
223
|
+
expect(subject.new(app).uid).to eq("Hi")
|
216
224
|
end
|
217
225
|
|
218
|
-
it "
|
226
|
+
it "inherits if it can" do
|
219
227
|
subject.uid{ "Hi" }
|
220
228
|
c = Class.new(subject)
|
221
|
-
c.new(app).uid.
|
229
|
+
expect(c.new(app).uid).to eq("Hi")
|
222
230
|
end
|
223
231
|
end
|
224
232
|
|
225
233
|
%w(info credentials extra).each do |fetcher|
|
226
234
|
subject{ fresh_strategy }
|
227
|
-
it "
|
235
|
+
it "is the current class's proc call if one exists" do
|
228
236
|
subject.send(fetcher){ {:abc => 123} }
|
229
|
-
subject.new(app).send(fetcher).
|
237
|
+
expect(subject.new(app).send(fetcher)).to eq({:abc => 123})
|
230
238
|
end
|
231
239
|
|
232
|
-
it
|
240
|
+
it "inherits by merging with preference for the latest class" do
|
233
241
|
subject.send(fetcher){ {:abc => 123, :def => 456} }
|
234
242
|
c = Class.new(subject)
|
235
243
|
c.send(fetcher){ {:abc => 789} }
|
236
|
-
c.new(app).send(fetcher).
|
244
|
+
expect(c.new(app).send(fetcher)).to eq({:abc => 789, :def => 456})
|
237
245
|
end
|
238
246
|
end
|
239
247
|
|
240
|
-
describe
|
248
|
+
describe "#call" do
|
241
249
|
let(:strategy){ ExampleStrategy.new(app, @options || {}) }
|
242
250
|
|
243
|
-
context
|
244
|
-
it
|
245
|
-
|
246
|
-
strategy.last_env['rack.session']['omniauth.origin'].
|
251
|
+
context "omniauth.origin" do
|
252
|
+
it "is set on the request phase" do
|
253
|
+
expect{strategy.call(make_env('/auth/test', 'HTTP_REFERER' => 'http://example.com/origin')) }.to raise_error("Request Phase")
|
254
|
+
expect(strategy.last_env['rack.session']['omniauth.origin']).to eq('http://example.com/origin')
|
247
255
|
end
|
248
256
|
|
249
|
-
it
|
250
|
-
|
251
|
-
strategy.last_env['omniauth.origin'].
|
257
|
+
it "is turned into an env variable on the callback phase" do
|
258
|
+
expect{strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'})) }.to raise_error("Callback Phase")
|
259
|
+
expect(strategy.last_env['omniauth.origin']).to eq('http://example.com/origin')
|
252
260
|
end
|
253
261
|
|
254
|
-
it
|
255
|
-
|
256
|
-
strategy.last_env['rack.session']['omniauth.origin'].
|
262
|
+
it "sets from the params if provided" do
|
263
|
+
expect{strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'origin=/foo')) }.to raise_error('Request Phase')
|
264
|
+
expect(strategy.last_env['rack.session']['omniauth.origin']).to eq('/foo')
|
257
265
|
end
|
258
266
|
|
259
|
-
it
|
267
|
+
it "is set on the failure env" do
|
260
268
|
OmniAuth.config.should_receive(:on_failure).and_return(lambda{|env| env})
|
261
269
|
@options = {:failure => :forced_fail}
|
262
270
|
strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => '/awesome'}))
|
263
271
|
end
|
264
272
|
|
265
273
|
context "with script_name" do
|
266
|
-
it
|
274
|
+
it "is set on the request phase, containing full path" do
|
267
275
|
env = {'HTTP_REFERER' => 'http://example.com/sub_uri/origin', 'SCRIPT_NAME' => '/sub_uri' }
|
268
|
-
|
269
|
-
strategy.last_env['rack.session']['omniauth.origin'].
|
276
|
+
expect{strategy.call(make_env('/auth/test', env)) }.to raise_error("Request Phase")
|
277
|
+
expect(strategy.last_env['rack.session']['omniauth.origin']).to eq('http://example.com/sub_uri/origin')
|
270
278
|
end
|
271
279
|
|
272
|
-
it
|
280
|
+
it "is turned into an env variable on the callback phase, containing full path" do
|
273
281
|
env = {
|
274
282
|
'rack.session' => {'omniauth.origin' => 'http://example.com/sub_uri/origin'},
|
275
283
|
'SCRIPT_NAME' => '/sub_uri'
|
276
284
|
}
|
277
285
|
|
278
|
-
|
279
|
-
strategy.last_env['omniauth.origin'].
|
286
|
+
expect{strategy.call(make_env('/auth/test/callback', env)) }.to raise_error("Callback Phase")
|
287
|
+
expect(strategy.last_env['omniauth.origin']).to eq('http://example.com/sub_uri/origin')
|
280
288
|
end
|
281
289
|
|
282
290
|
end
|
283
291
|
end
|
284
292
|
|
285
|
-
context
|
286
|
-
it
|
287
|
-
|
293
|
+
context "default paths" do
|
294
|
+
it "uses the default request path" do
|
295
|
+
expect{strategy.call(make_env) }.to raise_error("Request Phase")
|
288
296
|
end
|
289
297
|
|
290
|
-
it
|
291
|
-
|
298
|
+
it "is case insensitive on request path" do
|
299
|
+
expect{strategy.call(make_env('/AUTH/Test'))}.to raise_error("Request Phase")
|
292
300
|
end
|
293
301
|
|
294
|
-
it
|
295
|
-
|
302
|
+
it "is case insensitive on callback path" do
|
303
|
+
expect{strategy.call(make_env('/AUTH/TeSt/CaLlBAck'))}.to raise_error("Callback Phase")
|
296
304
|
end
|
297
305
|
|
298
|
-
it
|
299
|
-
|
306
|
+
it "uses the default callback path" do
|
307
|
+
expect{strategy.call(make_env('/auth/test/callback')) }.to raise_error("Callback Phase")
|
300
308
|
end
|
301
309
|
|
302
|
-
it
|
303
|
-
|
310
|
+
it "strips trailing spaces on request" do
|
311
|
+
expect{strategy.call(make_env('/auth/test/')) }.to raise_error("Request Phase")
|
304
312
|
end
|
305
313
|
|
306
|
-
it
|
307
|
-
|
314
|
+
it "strips trailing spaces on callback" do
|
315
|
+
expect{strategy.call(make_env('/auth/test/callback/')) }.to raise_error("Callback Phase")
|
308
316
|
end
|
309
317
|
|
310
|
-
context
|
311
|
-
it
|
318
|
+
context "callback_url" do
|
319
|
+
it "uses the default callback_path" do
|
312
320
|
strategy.should_receive(:full_host).and_return('http://example.com')
|
313
321
|
|
314
|
-
|
322
|
+
expect{strategy.call(make_env) }.to raise_error("Request Phase")
|
315
323
|
|
316
|
-
strategy.callback_url.
|
324
|
+
expect(strategy.callback_url).to eq('http://example.com/auth/test/callback')
|
317
325
|
end
|
318
326
|
|
319
|
-
it
|
327
|
+
it "preserves the query parameters" do
|
320
328
|
strategy.stub(:full_host).and_return('http://example.com')
|
321
329
|
begin
|
322
330
|
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
|
323
331
|
rescue RuntimeError; end
|
324
|
-
strategy.callback_url.
|
332
|
+
expect(strategy.callback_url).to eq('http://example.com/auth/test/callback?id=5')
|
325
333
|
end
|
326
334
|
|
327
|
-
it
|
335
|
+
it "consider script name" do
|
328
336
|
strategy.stub(:full_host).and_return('http://example.com')
|
329
337
|
begin
|
330
338
|
strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
|
331
339
|
rescue RuntimeError; end
|
332
|
-
strategy.callback_url.
|
340
|
+
expect(strategy.callback_url).to eq('http://example.com/sub_uri/auth/test/callback')
|
333
341
|
end
|
334
342
|
end
|
335
343
|
end
|
336
344
|
|
337
|
-
context
|
338
|
-
it
|
345
|
+
context ":form option" do
|
346
|
+
it "calls through to the supplied form option if one exists" do
|
339
347
|
strategy.options.form = lambda{|env| "Called me!"}
|
340
|
-
strategy.call(make_env('/auth/test')).
|
348
|
+
expect(strategy.call(make_env('/auth/test'))).to eq("Called me!")
|
341
349
|
end
|
342
350
|
|
343
|
-
it
|
351
|
+
it "calls through to the app if :form => true is set as an option" do
|
344
352
|
strategy.options.form = true
|
345
|
-
strategy.call(make_env('/auth/test')).
|
353
|
+
expect(strategy.call(make_env('/auth/test'))).to eq(app.call(make_env('/auth/test')))
|
346
354
|
end
|
347
355
|
end
|
348
356
|
|
349
|
-
context
|
350
|
-
it
|
357
|
+
context "dynamic paths" do
|
358
|
+
it "runs the request phase if the custom request path evaluator is truthy" do
|
351
359
|
@options = {:request_path => lambda{|env| true}}
|
352
|
-
|
360
|
+
expect{strategy.call(make_env('/asoufibasfi')) }.to raise_error("Request Phase")
|
353
361
|
end
|
354
362
|
|
355
|
-
it
|
363
|
+
it "runs the callback phase if the custom callback path evaluator is truthy" do
|
356
364
|
@options = {:callback_path => lambda{|env| true}}
|
357
|
-
|
365
|
+
expect{strategy.call(make_env('/asoufiasod')) }.to raise_error("Callback Phase")
|
358
366
|
end
|
359
367
|
|
360
|
-
it
|
368
|
+
it "provides a custom callback path if request_path evals to a string" do
|
361
369
|
strategy_instance = fresh_strategy.new(nil, :request_path => lambda{|env| "/auth/boo/callback/22" })
|
362
|
-
strategy_instance.callback_path.
|
363
|
-
end
|
370
|
+
expect(strategy_instance.callback_path).to eq('/auth/boo/callback/22')
|
371
|
+
end
|
364
372
|
end
|
365
373
|
|
366
|
-
context
|
367
|
-
it
|
374
|
+
context "custom paths" do
|
375
|
+
it "uses a custom request_path if one is provided" do
|
368
376
|
@options = {:request_path => '/awesome'}
|
369
|
-
|
377
|
+
expect{strategy.call(make_env('/awesome')) }.to raise_error("Request Phase")
|
370
378
|
end
|
371
379
|
|
372
|
-
it
|
380
|
+
it "uses a custom callback_path if one is provided" do
|
373
381
|
@options = {:callback_path => '/radical'}
|
374
|
-
|
382
|
+
expect{strategy.call(make_env('/radical')) }.to raise_error("Callback Phase")
|
375
383
|
end
|
376
384
|
|
377
|
-
context
|
378
|
-
it
|
385
|
+
context "callback_url" do
|
386
|
+
it "uses a custom callback_path if one is provided" do
|
379
387
|
@options = {:callback_path => '/radical'}
|
380
388
|
strategy.should_receive(:full_host).and_return('http://example.com')
|
381
389
|
|
382
|
-
|
390
|
+
expect{strategy.call(make_env('/radical')) }.to raise_error("Callback Phase")
|
383
391
|
|
384
|
-
strategy.callback_url.
|
392
|
+
expect(strategy.callback_url).to eq('http://example.com/radical')
|
385
393
|
end
|
386
394
|
|
387
|
-
it
|
395
|
+
it "preserves the query parameters" do
|
388
396
|
@options = {:callback_path => '/radical'}
|
389
397
|
strategy.stub(:full_host).and_return('http://example.com')
|
390
398
|
begin
|
391
399
|
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
|
392
400
|
rescue RuntimeError; end
|
393
|
-
strategy.callback_url.
|
401
|
+
expect(strategy.callback_url).to eq('http://example.com/radical?id=5')
|
394
402
|
end
|
395
403
|
end
|
396
404
|
end
|
397
405
|
|
398
|
-
context
|
406
|
+
context "custom prefix" do
|
399
407
|
before do
|
400
408
|
@options = {:path_prefix => '/wowzers'}
|
401
409
|
end
|
402
410
|
|
403
|
-
it
|
404
|
-
|
411
|
+
it "uses a custom prefix for request" do
|
412
|
+
expect{strategy.call(make_env('/wowzers/test')) }.to raise_error("Request Phase")
|
405
413
|
end
|
406
414
|
|
407
|
-
it
|
408
|
-
|
415
|
+
it "uses a custom prefix for callback" do
|
416
|
+
expect{strategy.call(make_env('/wowzers/test/callback')) }.to raise_error("Callback Phase")
|
409
417
|
end
|
410
418
|
|
411
|
-
context
|
412
|
-
it
|
419
|
+
context "callback_url" do
|
420
|
+
it "uses a custom prefix" do
|
413
421
|
strategy.should_receive(:full_host).and_return('http://example.com')
|
414
422
|
|
415
|
-
|
423
|
+
expect{strategy.call(make_env('/wowzers/test')) }.to raise_error("Request Phase")
|
416
424
|
|
417
|
-
strategy.callback_url.
|
425
|
+
expect(strategy.callback_url).to eq('http://example.com/wowzers/test/callback')
|
418
426
|
end
|
419
427
|
|
420
|
-
it
|
428
|
+
it "preserves the query parameters" do
|
421
429
|
strategy.stub(:full_host).and_return('http://example.com')
|
422
430
|
begin
|
423
431
|
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
|
424
432
|
rescue RuntimeError; end
|
425
|
-
strategy.callback_url.
|
433
|
+
expect(strategy.callback_url).to eq('http://example.com/wowzers/test/callback?id=5')
|
426
434
|
end
|
427
435
|
end
|
428
436
|
end
|
429
437
|
|
430
|
-
context
|
438
|
+
context "request method restriction" do
|
431
439
|
before do
|
432
440
|
OmniAuth.config.allowed_request_methods = [:post]
|
433
441
|
end
|
434
442
|
|
435
|
-
it
|
436
|
-
|
443
|
+
it "does not allow a request method of the wrong type" do
|
444
|
+
expect{strategy.call(make_env)}.not_to raise_error
|
437
445
|
end
|
438
446
|
|
439
|
-
it
|
440
|
-
|
447
|
+
it "allows a request method of the correct type" do
|
448
|
+
expect{strategy.call(make_env('/auth/test', 'REQUEST_METHOD' => 'POST'))}.to raise_error("Request Phase")
|
441
449
|
end
|
442
450
|
|
443
451
|
after do
|
@@ -445,36 +453,36 @@ describe OmniAuth::Strategy do
|
|
445
453
|
end
|
446
454
|
end
|
447
455
|
|
448
|
-
context
|
456
|
+
context "receiving an OPTIONS request" do
|
449
457
|
shared_examples_for "an OPTIONS request" do
|
450
|
-
it
|
451
|
-
response[0].
|
458
|
+
it "responds with 200" do
|
459
|
+
expect(response[0]).to eq(200)
|
452
460
|
end
|
453
461
|
|
454
|
-
it
|
455
|
-
response[1]['Allow'].
|
462
|
+
it "sets the Allow header properly" do
|
463
|
+
expect(response[1]['Allow']).to eq("GET, POST")
|
456
464
|
end
|
457
465
|
end
|
458
466
|
|
459
|
-
context
|
467
|
+
context "to the request path" do
|
460
468
|
let(:response) { strategy.call(make_env('/auth/test', 'REQUEST_METHOD' => 'OPTIONS')) }
|
461
|
-
|
469
|
+
it_behaves_like "an OPTIONS request"
|
462
470
|
end
|
463
471
|
|
464
|
-
context
|
472
|
+
context "to the request path" do
|
465
473
|
let(:response) { strategy.call(make_env('/auth/test/callback', 'REQUEST_METHOD' => 'OPTIONS')) }
|
466
|
-
|
474
|
+
it_behaves_like "an OPTIONS request"
|
467
475
|
end
|
468
476
|
|
469
|
-
context
|
470
|
-
it
|
477
|
+
context "to some other path" do
|
478
|
+
it "does not short-circuit the request" do
|
471
479
|
env = make_env('/other', 'REQUEST_METHOD' => 'OPTIONS')
|
472
|
-
strategy.call(env).
|
480
|
+
expect(strategy.call(env)).to eq(app.call(env))
|
473
481
|
end
|
474
482
|
end
|
475
483
|
end
|
476
484
|
|
477
|
-
context
|
485
|
+
context "test mode" do
|
478
486
|
let(:app) do
|
479
487
|
# In test mode, the underlying app shouldn't be called on request phase.
|
480
488
|
lambda { |env| [404, {"Content-Type" => "text/html"}, []] }
|
@@ -484,98 +492,98 @@ describe OmniAuth::Strategy do
|
|
484
492
|
OmniAuth.config.test_mode = true
|
485
493
|
end
|
486
494
|
|
487
|
-
it
|
495
|
+
it "short circuits the request phase entirely" do
|
488
496
|
response = strategy.call(make_env)
|
489
|
-
response[0].
|
490
|
-
response[1]['Location'].
|
497
|
+
expect(response[0]).to eq(302)
|
498
|
+
expect(response[1]['Location']).to eq('/auth/test/callback')
|
491
499
|
end
|
492
500
|
|
493
|
-
it
|
494
|
-
strategy.call(make_env('/AUTH/Test'))[0].
|
501
|
+
it "is case insensitive on request path" do
|
502
|
+
expect(strategy.call(make_env('/AUTH/Test'))[0]).to eq(302)
|
495
503
|
end
|
496
504
|
|
497
|
-
it
|
505
|
+
it "respects SCRIPT_NAME (a.k.a. BaseURI)" do
|
498
506
|
response = strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
|
499
|
-
response[1]['Location'].
|
507
|
+
expect(response[1]['Location']).to eq('/sub_uri/auth/test/callback')
|
500
508
|
end
|
501
509
|
|
502
|
-
it
|
510
|
+
it "redirects on failure" do
|
503
511
|
response = OmniAuth.config.on_failure.call(make_env('/auth/test', 'omniauth.error.type' => 'error'))
|
504
|
-
response[0].
|
505
|
-
response[1]['Location'].
|
512
|
+
expect(response[0]).to eq(302)
|
513
|
+
expect(response[1]['Location']).to eq('/auth/failure?message=error')
|
506
514
|
end
|
507
515
|
|
508
|
-
it
|
516
|
+
it "respects SCRIPT_NAME (a.k.a. BaseURI) on failure" do
|
509
517
|
response = OmniAuth.config.on_failure.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri', 'omniauth.error.type' => 'error'))
|
510
|
-
response[0].
|
511
|
-
response[1]['Location'].
|
518
|
+
expect(response[0]).to eq(302)
|
519
|
+
expect(response[1]['Location']).to eq('/sub_uri/auth/failure?message=error')
|
512
520
|
end
|
513
521
|
|
514
|
-
it
|
515
|
-
strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).first.
|
522
|
+
it "is case insensitive on callback path" do
|
523
|
+
expect(strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).first).to eq(strategy.call(make_env('/auth/test/callback')).first)
|
516
524
|
end
|
517
525
|
|
518
|
-
it
|
526
|
+
it "maintains query string parameters" do
|
519
527
|
response = strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'cheese=stilton'))
|
520
|
-
response[1]['Location'].
|
528
|
+
expect(response[1]['Location']).to eq('/auth/test/callback?cheese=stilton')
|
521
529
|
end
|
522
530
|
|
523
|
-
it
|
524
|
-
strategy.call(make_env('/')).
|
531
|
+
it "does not short circuit requests outside of authentication" do
|
532
|
+
expect(strategy.call(make_env('/'))).to eq(app.call(make_env('/')))
|
525
533
|
end
|
526
534
|
|
527
|
-
it
|
535
|
+
it "responds with the default hash if none is set" do
|
528
536
|
OmniAuth.config.mock_auth[:test] = nil
|
529
537
|
|
530
538
|
strategy.call make_env('/auth/test/callback')
|
531
|
-
strategy.env['omniauth.auth']['uid'].
|
539
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq('1234')
|
532
540
|
end
|
533
541
|
|
534
|
-
it
|
542
|
+
it "responds with a provider-specific hash if one is set" do
|
535
543
|
OmniAuth.config.mock_auth[:test] = {
|
536
544
|
'uid' => 'abc'
|
537
545
|
}
|
538
546
|
|
539
547
|
strategy.call make_env('/auth/test/callback')
|
540
|
-
strategy.env['omniauth.auth']['uid'].
|
548
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq('abc')
|
541
549
|
end
|
542
550
|
|
543
|
-
it
|
551
|
+
it "simulates login failure if mocked data is set as a symbol" do
|
544
552
|
OmniAuth.config.mock_auth[:test] = :invalid_credentials
|
545
553
|
|
546
554
|
strategy.call make_env('/auth/test/callback')
|
547
|
-
strategy.env['omniauth.error.type'].
|
555
|
+
expect(strategy.env['omniauth.error.type']).to eq(:invalid_credentials)
|
548
556
|
end
|
549
557
|
|
550
|
-
it
|
558
|
+
it "sets omniauth.origin on the request phase" do
|
551
559
|
strategy.call(make_env('/auth/test', 'HTTP_REFERER' => 'http://example.com/origin'))
|
552
|
-
strategy.env['rack.session']['omniauth.origin'].
|
560
|
+
expect(strategy.env['rack.session']['omniauth.origin']).to eq('http://example.com/origin')
|
553
561
|
end
|
554
562
|
|
555
|
-
it
|
563
|
+
it "sets omniauth.origin from the params if provided" do
|
556
564
|
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'origin=/foo'))
|
557
|
-
strategy.env['rack.session']['omniauth.origin'].
|
565
|
+
expect(strategy.env['rack.session']['omniauth.origin']).to eq('/foo')
|
558
566
|
end
|
559
567
|
|
560
|
-
it
|
568
|
+
it "turns omniauth.origin into an env variable on the callback phase" do
|
561
569
|
OmniAuth.config.mock_auth[:test] = {}
|
562
570
|
|
563
571
|
strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'}))
|
564
|
-
strategy.env['omniauth.origin'].
|
572
|
+
expect(strategy.env['omniauth.origin']).to eq('http://example.com/origin')
|
565
573
|
end
|
566
574
|
|
567
|
-
it
|
575
|
+
it "sets omniauth.params on the request phase" do
|
568
576
|
OmniAuth.config.mock_auth[:test] = {}
|
569
577
|
|
570
578
|
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'foo=bar'))
|
571
|
-
strategy.env['rack.session']['omniauth.params'].
|
579
|
+
expect(strategy.env['rack.session']['omniauth.params']).to eq({'foo' => 'bar'})
|
572
580
|
end
|
573
581
|
|
574
|
-
it
|
582
|
+
it "turns omniauth.params into an env variable on the callback phase" do
|
575
583
|
OmniAuth.config.mock_auth[:test] = {}
|
576
584
|
|
577
585
|
strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.params' => {'foo' => 'bar'}}))
|
578
|
-
strategy.env['omniauth.params'].
|
586
|
+
expect(strategy.env['omniauth.params']).to eq({'foo' => 'bar'})
|
579
587
|
end
|
580
588
|
|
581
589
|
after do
|
@@ -583,20 +591,20 @@ describe OmniAuth::Strategy do
|
|
583
591
|
end
|
584
592
|
end
|
585
593
|
|
586
|
-
context
|
594
|
+
context "custom full_host" do
|
587
595
|
before do
|
588
596
|
OmniAuth.config.test_mode = true
|
589
597
|
end
|
590
598
|
|
591
|
-
it
|
599
|
+
it "is the string when a string is there" do
|
592
600
|
OmniAuth.config.full_host = 'my.host.com'
|
593
|
-
strategy.full_host.
|
601
|
+
expect(strategy.full_host).to eq('my.host.com')
|
594
602
|
end
|
595
603
|
|
596
|
-
it
|
604
|
+
it "runs the proc with the env when it is a proc" do
|
597
605
|
OmniAuth.config.full_host = Proc.new{|env| env['HOST']}
|
598
606
|
strategy.call(make_env('/auth/test', 'HOST' => 'my.host.net'))
|
599
|
-
strategy.full_host.
|
607
|
+
expect(strategy.full_host).to eq('my.host.net')
|
600
608
|
end
|
601
609
|
|
602
610
|
after do
|
@@ -605,27 +613,27 @@ describe OmniAuth::Strategy do
|
|
605
613
|
end
|
606
614
|
end
|
607
615
|
|
608
|
-
context
|
616
|
+
context "setup phase" do
|
609
617
|
before do
|
610
618
|
OmniAuth.config.test_mode = true
|
611
619
|
end
|
612
620
|
|
613
|
-
context
|
621
|
+
context "when options[:setup] = true" do
|
614
622
|
let(:strategy){ ExampleStrategy.new(app, :setup => true) }
|
615
623
|
let(:app){lambda{|env| env['omniauth.strategy'].options[:awesome] = 'sauce' if env['PATH_INFO'] == '/auth/test/setup'; [404, {}, 'Awesome'] }}
|
616
624
|
|
617
|
-
it
|
625
|
+
it "calls through to /auth/:provider/setup" do
|
618
626
|
strategy.call(make_env('/auth/test'))
|
619
|
-
strategy.options[:awesome].
|
627
|
+
expect(strategy.options[:awesome]).to eq('sauce')
|
620
628
|
end
|
621
629
|
|
622
|
-
it
|
630
|
+
it "does not call through on a non-omniauth endpoint" do
|
623
631
|
strategy.call(make_env('/somewhere/else'))
|
624
|
-
strategy.options[:awesome].
|
632
|
+
expect(strategy.options[:awesome]).not_to eq('sauce')
|
625
633
|
end
|
626
634
|
end
|
627
635
|
|
628
|
-
context
|
636
|
+
context "when options[:setup] is an app" do
|
629
637
|
let(:setup_proc) do
|
630
638
|
Proc.new do |env|
|
631
639
|
env['omniauth.strategy'].options[:awesome] = 'sauce'
|
@@ -634,14 +642,14 @@ describe OmniAuth::Strategy do
|
|
634
642
|
|
635
643
|
let(:strategy){ ExampleStrategy.new(app, :setup => setup_proc) }
|
636
644
|
|
637
|
-
it
|
645
|
+
it "does not call the app on a non-omniauth endpoint" do
|
638
646
|
strategy.call(make_env('/somehwere/else'))
|
639
|
-
strategy.options[:awesome].
|
647
|
+
expect(strategy.options[:awesome]).not_to eq('sauce')
|
640
648
|
end
|
641
649
|
|
642
|
-
it
|
650
|
+
it "calls the rack app" do
|
643
651
|
strategy.call(make_env('/auth/test'))
|
644
|
-
strategy.options[:awesome].
|
652
|
+
expect(strategy.options[:awesome]).to eq('sauce')
|
645
653
|
end
|
646
654
|
end
|
647
655
|
|
@@ -649,4 +657,4 @@ describe OmniAuth::Strategy do
|
|
649
657
|
OmniAuth.config.test_mode = false
|
650
658
|
end
|
651
659
|
end
|
652
|
-
end
|
660
|
+
end
|