oa-core 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/.rspec +3 -0
- data/.yardopts +4 -0
- data/Gemfile +3 -0
- data/Rakefile +6 -0
- data/autotest/discover.rb +1 -0
- data/oa-core.gemspec +22 -0
- data/spec/omniauth/builder_spec.rb +20 -0
- data/spec/omniauth/core_spec.rb +79 -0
- data/spec/omniauth/strategy_spec.rb +342 -0
- data/spec/spec_helper.rb +16 -0
- metadata +44 -78
data/.gemtest
ADDED
File without changes
|
data/.rspec
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { "rspec2" }
|
data/oa-core.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../../omniauth/lib/omniauth/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.add_development_dependency 'simplecov', '~> 0.4'
|
6
|
+
gem.add_development_dependency 'rack-test', '~> 0.5'
|
7
|
+
gem.add_development_dependency 'rake', '~> 0.8'
|
8
|
+
gem.add_development_dependency 'rspec', '~> 2.5'
|
9
|
+
gem.add_development_dependency 'yard', '~> 0.6'
|
10
|
+
gem.name = 'oa-core'
|
11
|
+
gem.version = Omniauth::VERSION.dup
|
12
|
+
gem.summary = %q{HTTP Basic strategies for OmniAuth.}
|
13
|
+
gem.description = %q{HTTP Basic strategies for OmniAuth.}
|
14
|
+
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
|
15
|
+
gem.homepage = 'http://github.com/intridea/omniauth'
|
16
|
+
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
|
17
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
18
|
+
gem.files = `git ls-files`.split("\n")
|
19
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
gem.require_paths = ['lib']
|
21
|
+
gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Builder do
|
4
|
+
describe '#provider' do
|
5
|
+
it 'should translate a symbol to a constant' do
|
6
|
+
OmniAuth::Strategies.should_receive(:const_get).with('MyStrategy').and_return(Class.new)
|
7
|
+
OmniAuth::Builder.new(nil) do
|
8
|
+
provider :my_strategy
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should also just accept a class' do
|
13
|
+
class ::ExampleClass; end
|
14
|
+
|
15
|
+
lambda{ OmniAuth::Builder.new(nil) do
|
16
|
+
provider ::ExampleClass
|
17
|
+
end }.should_not raise_error
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth do
|
4
|
+
describe '.strategies' do
|
5
|
+
it 'should increase when a new strategy is made' do
|
6
|
+
lambda{ class ExampleStrategy
|
7
|
+
include OmniAuth::Strategy
|
8
|
+
end }.should change(OmniAuth.strategies, :size).by(1)
|
9
|
+
OmniAuth.strategies.last.should == ExampleStrategy
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'configuration' do
|
14
|
+
it 'should be callable from .configure' do
|
15
|
+
OmniAuth.configure do |c|
|
16
|
+
c.should be_kind_of(OmniAuth::Configuration)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
before do
|
21
|
+
@old_path_prefix = OmniAuth.config.path_prefix
|
22
|
+
@old_on_failure = OmniAuth.config.on_failure
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
OmniAuth.configure do |config|
|
27
|
+
config.path_prefix = @old_path_prefix
|
28
|
+
config.on_failure = @old_on_failure
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should be able to set the path' do
|
33
|
+
OmniAuth.configure do |config|
|
34
|
+
config.path_prefix = '/awesome'
|
35
|
+
end
|
36
|
+
|
37
|
+
OmniAuth.config.path_prefix.should == '/awesome'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should be able to set the on_failure rack app' do
|
41
|
+
OmniAuth.configure do |config|
|
42
|
+
config.on_failure do
|
43
|
+
'yoyo'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
OmniAuth.config.on_failure.call.should == 'yoyo'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '::Utils' do
|
52
|
+
describe '.deep_merge' do
|
53
|
+
it 'should combine hashes' do
|
54
|
+
OmniAuth::Utils.deep_merge({'abc' => {'def' => 123}}, {'abc' => {'foo' => 'bar'}}).should == {
|
55
|
+
'abc' => {'def' => 123, 'foo' => 'bar'}
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '.camelize' do
|
61
|
+
it 'should work on normal cases' do
|
62
|
+
{
|
63
|
+
'some_word' => 'SomeWord',
|
64
|
+
'AnotherWord' => 'AnotherWord',
|
65
|
+
'one' => 'One',
|
66
|
+
'three_words_now' => 'ThreeWordsNow'
|
67
|
+
}.each_pair{ |k,v| OmniAuth::Utils.camelize(k).should == v }
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should work in special cases' do
|
71
|
+
{
|
72
|
+
'oauth' => "OAuth",
|
73
|
+
'openid' => 'OpenID',
|
74
|
+
'open_id' => 'OpenID'
|
75
|
+
}.each_pair{ |k,v| OmniAuth::Utils.camelize(k).should == v}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,342 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ExampleStrategy
|
4
|
+
include OmniAuth::Strategy
|
5
|
+
def call(env); self.call!(env) end
|
6
|
+
attr_reader :last_env
|
7
|
+
def request_phase
|
8
|
+
@fail = fail!(options[:failure]) if options[:failure]
|
9
|
+
@last_env = env
|
10
|
+
return @fail if @fail
|
11
|
+
raise "Request Phase"
|
12
|
+
end
|
13
|
+
def callback_phase
|
14
|
+
@fail = fail!(options[:failure]) if options[:failure]
|
15
|
+
@last_env = env
|
16
|
+
return @fail if @fail
|
17
|
+
raise "Callback Phase"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def make_env(path = '/auth/test', props = {})
|
22
|
+
{
|
23
|
+
'REQUEST_METHOD' => 'GET',
|
24
|
+
'PATH_INFO' => path,
|
25
|
+
'rack.session' => {},
|
26
|
+
'rack.input' => StringIO.new('test=true')
|
27
|
+
}.merge(props)
|
28
|
+
end
|
29
|
+
|
30
|
+
describe OmniAuth::Strategy do
|
31
|
+
let(:app){ lambda{|env| [404, {}, ['Awesome']]}}
|
32
|
+
describe '#initialize' do
|
33
|
+
context 'options extraction' do
|
34
|
+
it 'should be the last argument if the last argument is a Hash' do
|
35
|
+
ExampleStrategy.new(app, 'test', :abc => 123).options[:abc].should == 123
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should be a blank hash if none are provided' do
|
39
|
+
ExampleStrategy.new(app, 'test').options.should == {}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#full_host' do
|
45
|
+
let(:strategy){ ExampleStrategy.new(app, 'test', {}) }
|
46
|
+
it 'should not freak out if there is a pipe in the URL' do
|
47
|
+
strategy.call!(make_env('/whatever', 'rack.url_scheme' => 'http', 'SERVER_NAME' => 'facebook.lame', 'QUERY_STRING' => 'code=asofibasf|asoidnasd', 'SCRIPT_NAME' => '', 'SERVER_PORT' => 80))
|
48
|
+
lambda{ strategy.full_host }.should_not raise_error
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#call' do
|
53
|
+
let(:strategy){ ExampleStrategy.new(app, 'test', @options) }
|
54
|
+
|
55
|
+
context 'omniauth.origin' do
|
56
|
+
it 'should be set on the request phase' do
|
57
|
+
lambda{ strategy.call(make_env('/auth/test', 'HTTP_REFERER' => 'http://example.com/origin')) }.should raise_error("Request Phase")
|
58
|
+
strategy.last_env['rack.session']['omniauth.origin'].should == 'http://example.com/origin'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should be turned into an env variable on the callback phase' do
|
62
|
+
lambda{ strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'})) }.should raise_error("Callback Phase")
|
63
|
+
strategy.last_env['omniauth.origin'].should == 'http://example.com/origin'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should set from the params if provided' do
|
67
|
+
lambda{ strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'origin=/foo')) }.should raise_error('Request Phase')
|
68
|
+
strategy.last_env['rack.session']['omniauth.origin'].should == '/foo'
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should be set on the failure env' do
|
72
|
+
OmniAuth.config.should_receive(:on_failure).and_return(lambda{|env| env})
|
73
|
+
@options = {:failure => :forced_fail}
|
74
|
+
strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => '/awesome'}))
|
75
|
+
end
|
76
|
+
|
77
|
+
context "with script_name" do
|
78
|
+
it 'should be set on the request phase, containing full path' do
|
79
|
+
env = {'HTTP_REFERER' => 'http://example.com/sub_uri/origin', 'SCRIPT_NAME' => '/sub_uri' }
|
80
|
+
lambda{ strategy.call(make_env('/auth/test', env)) }.should raise_error("Request Phase")
|
81
|
+
strategy.last_env['rack.session']['omniauth.origin'].should == 'http://example.com/sub_uri/origin'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should be turned into an env variable on the callback phase, containing full path' do
|
85
|
+
env = {
|
86
|
+
'rack.session' => {'omniauth.origin' => 'http://example.com/sub_uri/origin'},
|
87
|
+
'SCRIPT_NAME' => '/sub_uri'
|
88
|
+
}
|
89
|
+
|
90
|
+
lambda{ strategy.call(make_env('/auth/test/callback', env)) }.should raise_error("Callback Phase")
|
91
|
+
strategy.last_env['omniauth.origin'].should == 'http://example.com/sub_uri/origin'
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'default paths' do
|
98
|
+
it 'should use the default request path' do
|
99
|
+
lambda{ strategy.call(make_env) }.should raise_error("Request Phase")
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should use the default callback path' do
|
103
|
+
lambda{ strategy.call(make_env('/auth/test/callback')) }.should raise_error("Callback Phase")
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should strip trailing spaces on request' do
|
107
|
+
lambda{ strategy.call(make_env('/auth/test/')) }.should raise_error("Request Phase")
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should strip trailing spaces on callback' do
|
111
|
+
lambda{ strategy.call(make_env('/auth/test/callback/')) }.should raise_error("Callback Phase")
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'callback_url' do
|
115
|
+
it 'uses the default callback_path' do
|
116
|
+
strategy.should_receive(:full_host).and_return('http://example.com')
|
117
|
+
|
118
|
+
lambda{ strategy.call(make_env) }.should raise_error("Request Phase")
|
119
|
+
|
120
|
+
strategy.callback_url.should == 'http://example.com/auth/test/callback'
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'preserves the query parameters' do
|
124
|
+
strategy.stub(:full_host).and_return('http://example.com')
|
125
|
+
begin
|
126
|
+
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
|
127
|
+
rescue RuntimeError; end
|
128
|
+
strategy.callback_url.should == 'http://example.com/auth/test/callback?id=5'
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'consider script name' do
|
132
|
+
strategy.stub(:full_host).and_return('http://example.com')
|
133
|
+
begin
|
134
|
+
strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
|
135
|
+
rescue RuntimeError; end
|
136
|
+
strategy.callback_url.should == 'http://example.com/sub_uri/auth/test/callback'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'pre-request call through' do
|
142
|
+
subject { ExampleStrategy.new(app, 'test') }
|
143
|
+
let(:app){ lambda{|env| env['omniauth.boom'] = true; [env['test.status'] || 404, {}, ['Whatev']] } }
|
144
|
+
it 'should be able to modify the env on the fly before the request_phase' do
|
145
|
+
lambda{ subject.call(make_env) }.should raise_error("Request Phase")
|
146
|
+
subject.response.status.should == 404
|
147
|
+
subject.last_env.should be_key('omniauth.boom')
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'should call through to the app instead if a non-404 response is received' do
|
151
|
+
lambda{ subject.call(make_env('/auth/test', 'test.status' => 200)) }.should_not raise_error
|
152
|
+
subject.response.body.should == ['Whatev']
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context 'custom paths' do
|
157
|
+
it 'should use a custom request_path if one is provided' do
|
158
|
+
@options = {:request_path => '/awesome'}
|
159
|
+
lambda{ strategy.call(make_env('/awesome')) }.should raise_error("Request Phase")
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'should use a custom callback_path if one is provided' do
|
163
|
+
@options = {:callback_path => '/radical'}
|
164
|
+
lambda{ strategy.call(make_env('/radical')) }.should raise_error("Callback Phase")
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'callback_url' do
|
168
|
+
it 'uses a custom callback_path if one is provided' do
|
169
|
+
@options = {:callback_path => '/radical'}
|
170
|
+
strategy.should_receive(:full_host).and_return('http://example.com')
|
171
|
+
|
172
|
+
lambda{ strategy.call(make_env('/radical')) }.should raise_error("Callback Phase")
|
173
|
+
|
174
|
+
strategy.callback_url.should == 'http://example.com/radical'
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'preserves the query parameters' do
|
178
|
+
@options = {:callback_path => '/radical'}
|
179
|
+
strategy.stub(:full_host).and_return('http://example.com')
|
180
|
+
begin
|
181
|
+
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
|
182
|
+
rescue RuntimeError; end
|
183
|
+
strategy.callback_url.should == 'http://example.com/radical?id=5'
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'custom prefix' do
|
189
|
+
before do
|
190
|
+
@options = {:path_prefix => '/wowzers'}
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'should use a custom prefix for request' do
|
194
|
+
lambda{ strategy.call(make_env('/wowzers/test')) }.should raise_error("Request Phase")
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'should use a custom prefix for callback' do
|
198
|
+
lambda{ strategy.call(make_env('/wowzers/test/callback')) }.should raise_error("Callback Phase")
|
199
|
+
end
|
200
|
+
|
201
|
+
context 'callback_url' do
|
202
|
+
it 'uses a custom prefix' do
|
203
|
+
strategy.should_receive(:full_host).and_return('http://example.com')
|
204
|
+
|
205
|
+
lambda{ strategy.call(make_env('/wowzers/test')) }.should raise_error("Request Phase")
|
206
|
+
|
207
|
+
strategy.callback_url.should == 'http://example.com/wowzers/test/callback'
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'preserves the query parameters' do
|
211
|
+
strategy.stub(:full_host).and_return('http://example.com')
|
212
|
+
begin
|
213
|
+
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
|
214
|
+
rescue RuntimeError; end
|
215
|
+
strategy.callback_url.should == 'http://example.com/wowzers/test/callback?id=5'
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
context 'request method restriction' do
|
221
|
+
before do
|
222
|
+
OmniAuth.config.allowed_request_methods = [:post]
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'should not allow a request method of the wrong type' do
|
226
|
+
lambda{ strategy.call(make_env)}.should_not raise_error
|
227
|
+
end
|
228
|
+
|
229
|
+
it 'should allow a request method of the correct type' do
|
230
|
+
lambda{ strategy.call(make_env('/auth/test', 'REQUEST_METHOD' => 'POST'))}.should raise_error("Request Phase")
|
231
|
+
end
|
232
|
+
|
233
|
+
after do
|
234
|
+
OmniAuth.config.allowed_request_methods = [:get, :post]
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
context 'test mode' do
|
239
|
+
before do
|
240
|
+
OmniAuth.config.test_mode = true
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'should short circuit the request phase entirely' do
|
244
|
+
response = strategy.call(make_env)
|
245
|
+
response[0].should == 302
|
246
|
+
response[1]['Location'].should == '/auth/test/callback'
|
247
|
+
end
|
248
|
+
|
249
|
+
it 'should not short circuit requests outside of authentication' do
|
250
|
+
strategy.call(make_env('/')).should == app.call(make_env('/'))
|
251
|
+
end
|
252
|
+
|
253
|
+
it 'should respond with the default hash if none is set' do
|
254
|
+
strategy.call make_env('/auth/test/callback')
|
255
|
+
strategy.env['omniauth.auth']['uid'].should == '1234'
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'should respond with a provider-specific hash if one is set' do
|
259
|
+
OmniAuth.config.mock_auth[:test] = {
|
260
|
+
'uid' => 'abc'
|
261
|
+
}
|
262
|
+
|
263
|
+
strategy.call make_env('/auth/test/callback')
|
264
|
+
strategy.env['omniauth.auth']['uid'].should == 'abc'
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'should simulate login failure if mocked data is set as a symbol' do
|
268
|
+
OmniAuth.config.mock_auth[:test] = :invalid_credentials
|
269
|
+
|
270
|
+
strategy.call make_env('/auth/test/callback')
|
271
|
+
strategy.env['omniauth.error.type'].should == :invalid_credentials
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should set omniauth.origin on the request phase' do
|
275
|
+
strategy.call(make_env('/auth/test', 'HTTP_REFERER' => 'http://example.com/origin'))
|
276
|
+
strategy.env['rack.session']['omniauth.origin'].should == 'http://example.com/origin'
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'should set omniauth.origin from the params if provided' do
|
280
|
+
strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'origin=/foo'))
|
281
|
+
strategy.env['rack.session']['omniauth.origin'].should == '/foo'
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'should turn omniauth.origin into an env variable on the callback phase' do
|
285
|
+
OmniAuth.config.mock_auth[:test] = {}
|
286
|
+
|
287
|
+
strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'}))
|
288
|
+
strategy.env['omniauth.origin'].should == 'http://example.com/origin'
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
context 'custom full_host' do
|
293
|
+
it 'should be the string when a string is there' do
|
294
|
+
OmniAuth.config.full_host = 'my.host.com'
|
295
|
+
strategy.full_host.should == 'my.host.com'
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'should run the proc with the env when it is a proc' do
|
299
|
+
OmniAuth.config.full_host = Proc.new{|env| env['HOST']}
|
300
|
+
strategy.call(make_env('/auth/test', 'HOST' => 'my.host.net'))
|
301
|
+
strategy.full_host.should == 'my.host.net'
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
context 'setup phase' do
|
307
|
+
context 'when options[:setup] = true' do
|
308
|
+
let(:strategy){ ExampleStrategy.new(app, 'test', :setup => true) }
|
309
|
+
let(:app){lambda{|env| env['omniauth.strategy'].options[:awesome] = 'sauce' if env['PATH_INFO'] == '/auth/test/setup'; [404, {}, 'Awesome'] }}
|
310
|
+
|
311
|
+
it 'should call through to /auth/:provider/setup' do
|
312
|
+
strategy.call(make_env('/auth/test'))
|
313
|
+
strategy.options[:awesome].should == 'sauce'
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should not call through on a non-omniauth endpoint' do
|
317
|
+
strategy.call(make_env('/somewhere/else'))
|
318
|
+
strategy.options[:awesome].should_not == 'sauce'
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
context 'when options[:setup] is an app' do
|
323
|
+
let(:setup_proc) do
|
324
|
+
Proc.new do |env|
|
325
|
+
env['omniauth.strategy'].options[:awesome] = 'sauce'
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
let(:strategy){ ExampleStrategy.new(app, 'test', :setup => setup_proc) }
|
330
|
+
|
331
|
+
it 'should not call the app on a non-omniauth endpoint' do
|
332
|
+
strategy.call(make_env('/somehwere/else'))
|
333
|
+
strategy.options[:awesome].should_not == 'sauce'
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'should call the rack app' do
|
337
|
+
strategy.call(make_env('/auth/test'))
|
338
|
+
strategy.options[:awesome].should == 'sauce'
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.setup
|
6
|
+
require 'rspec'
|
7
|
+
require 'rspec/autorun'
|
8
|
+
require 'rack/test'
|
9
|
+
require 'omniauth/core'
|
10
|
+
require 'omniauth/test'
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
16
|
+
|
metadata
CHANGED
@@ -2,118 +2,76 @@
|
|
2
2
|
name: oa-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Bleigh
|
9
|
+
- Erik Michaels-Ober
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
13
|
|
13
|
-
date: 2011-04-
|
14
|
-
default_executable:
|
14
|
+
date: 2011-04-22 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: simplecov
|
18
|
+
prerelease: false
|
18
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
20
|
none: false
|
20
21
|
requirements:
|
21
22
|
- - ~>
|
22
23
|
- !ruby/object:Gem::Version
|
23
|
-
version: "
|
24
|
-
type: :
|
25
|
-
prerelease: false
|
24
|
+
version: "0.4"
|
25
|
+
type: :development
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rack-test
|
29
|
+
prerelease: false
|
29
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
31
|
none: false
|
31
32
|
requirements:
|
32
|
-
- -
|
33
|
+
- - ~>
|
33
34
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
35
|
+
version: "0.5"
|
35
36
|
type: :development
|
36
|
-
prerelease: false
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rake
|
40
|
+
prerelease: false
|
40
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
42
|
none: false
|
42
43
|
requirements:
|
43
|
-
- -
|
44
|
+
- - ~>
|
44
45
|
- !ruby/object:Gem::Version
|
45
|
-
version: "0"
|
46
|
+
version: "0.8"
|
46
47
|
type: :development
|
47
|
-
prerelease: false
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
51
52
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
53
|
none: false
|
53
54
|
requirements:
|
54
55
|
- - ~>
|
55
56
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
57
|
+
version: "2.5"
|
57
58
|
type: :development
|
58
|
-
prerelease: false
|
59
59
|
version_requirements: *id004
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: yard
|
62
|
+
prerelease: false
|
62
63
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
64
|
none: false
|
64
65
|
requirements:
|
65
66
|
- - ~>
|
66
67
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
68
|
+
version: "0.6"
|
68
69
|
type: :development
|
69
|
-
prerelease: false
|
70
70
|
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: webmock
|
73
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 1.3.4
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: rack-test
|
84
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
|
-
requirements:
|
87
|
-
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.5.4
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: json_pure
|
95
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
|
-
requirements:
|
98
|
-
- - ~>
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: 1.5.1
|
101
|
-
type: :development
|
102
|
-
prerelease: false
|
103
|
-
version_requirements: *id008
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
name: evernote
|
106
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
|
-
requirements:
|
109
|
-
- - ~>
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 0.9.0
|
112
|
-
type: :development
|
113
|
-
prerelease: false
|
114
|
-
version_requirements: *id009
|
115
71
|
description: HTTP Basic strategies for OmniAuth.
|
116
|
-
email:
|
72
|
+
email:
|
73
|
+
- michael@intridea.com
|
74
|
+
- sferik@gmail.com
|
117
75
|
executables: []
|
118
76
|
|
119
77
|
extensions: []
|
@@ -121,17 +79,27 @@ extensions: []
|
|
121
79
|
extra_rdoc_files: []
|
122
80
|
|
123
81
|
files:
|
82
|
+
- .gemtest
|
83
|
+
- .rspec
|
84
|
+
- .yardopts
|
85
|
+
- Gemfile
|
86
|
+
- LICENSE
|
87
|
+
- Rakefile
|
88
|
+
- autotest/discover.rb
|
124
89
|
- lib/oa-core.rb
|
125
90
|
- lib/omniauth/builder.rb
|
126
91
|
- lib/omniauth/core.rb
|
127
92
|
- lib/omniauth/form.rb
|
128
93
|
- lib/omniauth/strategy.rb
|
94
|
+
- lib/omniauth/test.rb
|
129
95
|
- lib/omniauth/test/phony_session.rb
|
130
96
|
- lib/omniauth/test/strategy_macros.rb
|
131
97
|
- lib/omniauth/test/strategy_test_case.rb
|
132
|
-
-
|
133
|
-
-
|
134
|
-
|
98
|
+
- oa-core.gemspec
|
99
|
+
- spec/omniauth/builder_spec.rb
|
100
|
+
- spec/omniauth/core_spec.rb
|
101
|
+
- spec/omniauth/strategy_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
135
103
|
homepage: http://github.com/intridea/omniauth
|
136
104
|
licenses: []
|
137
105
|
|
@@ -145,25 +113,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
113
|
requirements:
|
146
114
|
- - ">="
|
147
115
|
- !ruby/object:Gem::Version
|
148
|
-
hash: -927644400765707217
|
149
|
-
segments:
|
150
|
-
- 0
|
151
116
|
version: "0"
|
152
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
118
|
none: false
|
154
119
|
requirements:
|
155
120
|
- - ">="
|
156
121
|
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
version: "0"
|
122
|
+
version: 1.3.6
|
161
123
|
requirements: []
|
162
124
|
|
163
125
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.
|
126
|
+
rubygems_version: 1.7.2
|
165
127
|
signing_key:
|
166
128
|
specification_version: 3
|
167
129
|
summary: HTTP Basic strategies for OmniAuth.
|
168
|
-
test_files:
|
169
|
-
|
130
|
+
test_files:
|
131
|
+
- spec/omniauth/builder_spec.rb
|
132
|
+
- spec/omniauth/core_spec.rb
|
133
|
+
- spec/omniauth/strategy_spec.rb
|
134
|
+
- spec/spec_helper.rb
|
135
|
+
has_rdoc:
|