omniauth-mailru 0.3.2 → 1.0.0
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.
@@ -15,6 +15,8 @@ module OmniAuth
|
|
15
15
|
:authorize_url => '/oauth/authorize'
|
16
16
|
}
|
17
17
|
|
18
|
+
option :callback_url
|
19
|
+
|
18
20
|
uid do
|
19
21
|
access_token.params['x_mailru_vid']
|
20
22
|
end
|
@@ -39,11 +41,7 @@ module OmniAuth
|
|
39
41
|
end
|
40
42
|
|
41
43
|
def callback_url
|
42
|
-
|
43
|
-
options.authorize_options.callback_url
|
44
|
-
else
|
45
|
-
super
|
46
|
-
end
|
44
|
+
options.callback_url || super
|
47
45
|
end
|
48
46
|
|
49
47
|
private
|
@@ -1,11 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe OmniAuth::Strategies::Mailru do
|
4
|
-
|
5
|
-
|
4
|
+
before :each do
|
5
|
+
@request = double('Request')
|
6
|
+
@request.stub(:params) { {} }
|
7
|
+
@request.stub(:cookies) { {} }
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
@client_id = '123'
|
10
|
+
@client_secret = '53cr3tz'
|
9
11
|
end
|
10
12
|
|
13
|
+
subject do
|
14
|
+
args = [@client_id, @client_secret, @options].compact
|
15
|
+
OmniAuth::Strategies::Mailru.new(nil, *args).tap do |strategy|
|
16
|
+
strategy.stub(:request) { @request }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it_should_behave_like 'an oauth2 strategy'
|
21
|
+
|
22
|
+
describe '#callback_url' do
|
23
|
+
it "returns value from #authorize_options" do
|
24
|
+
url = 'http://auth.myapp.com/auth/mailru/callback'
|
25
|
+
@options = { :callback_url => url }
|
26
|
+
subject.callback_url.should eq(url)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "callback_url from request" do
|
30
|
+
url_base = 'http://auth.request.com'
|
31
|
+
@request.stub(:url) { "#{url_base}/page/path" }
|
32
|
+
subject.stub(:script_name) { "" } # to not depend from Rack env
|
33
|
+
subject.callback_url.should eq("#{url_base}/auth/mailru/callback")
|
34
|
+
end
|
35
|
+
end
|
11
36
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
$:.unshift File.expand_path('..', __FILE__)
|
2
2
|
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
3
|
require 'rspec'
|
4
|
-
require 'rack/test'
|
5
|
-
require 'webmock/rspec'
|
6
4
|
require 'omniauth'
|
7
5
|
require 'omniauth-mailru'
|
8
6
|
|
7
|
+
Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
|
8
|
+
|
9
9
|
RSpec.configure do |config|
|
10
|
-
config.include WebMock::API
|
11
|
-
config.include Rack::Test::Methods
|
12
|
-
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
13
10
|
end
|
14
11
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
shared_examples 'an oauth2 strategy' do
|
3
|
+
describe '#client' do
|
4
|
+
it 'should be initialized with symbolized client_options' do
|
5
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
6
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#authorize_params' do
|
11
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
12
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
13
|
+
subject.authorize_params['foo'].should eq('bar')
|
14
|
+
subject.authorize_params['baz'].should eq('zip')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
18
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
19
|
+
subject.authorize_params['scope'].should eq('bar')
|
20
|
+
subject.authorize_params['foo'].should eq('baz')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#token_params' do
|
25
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
26
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
27
|
+
subject.token_params['foo'].should eq('bar')
|
28
|
+
subject.token_params['baz'].should eq('zip')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
32
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
33
|
+
subject.token_params['scope'].should eq('bar')
|
34
|
+
subject.token_params['foo'].should eq('baz')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-mailru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11
|
12
|
+
date: 2011-12-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &70121730162580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70121730162580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: omniauth-oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &70121730161380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '1.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70121730161380
|
36
36
|
description: OmniAuth strategy for Mail.ru
|
37
37
|
email:
|
38
38
|
- gumayunov@gmail.com
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- omniauth-mailru.gemspec
|
55
55
|
- spec/omniauth/strategies/mailru_spec.rb
|
56
56
|
- spec/spec_helper.rb
|
57
|
+
- spec/support/shared_examples.rb
|
57
58
|
homepage: https://github.com/gumayuniv/omniauth-mailru
|
58
59
|
licenses: []
|
59
60
|
post_install_message:
|
@@ -68,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
69
|
version: '0'
|
69
70
|
segments:
|
70
71
|
- 0
|
71
|
-
hash:
|
72
|
+
hash: -4176488684419129791
|
72
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
74
75
|
requirements:
|
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
version: '0'
|
78
79
|
segments:
|
79
80
|
- 0
|
80
|
-
hash:
|
81
|
+
hash: -4176488684419129791
|
81
82
|
requirements: []
|
82
83
|
rubyforge_project: omniauth-mailru
|
83
84
|
rubygems_version: 1.8.10
|
@@ -87,3 +88,4 @@ summary: OmniAuth strategy for Mail.ru
|
|
87
88
|
test_files:
|
88
89
|
- spec/omniauth/strategies/mailru_spec.rb
|
89
90
|
- spec/spec_helper.rb
|
91
|
+
- spec/support/shared_examples.rb
|