omniauth-twitter 1.3.0 → 1.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52c9f56011876c1784202d2593fdee0700f4af01
4
- data.tar.gz: 2f7447de538407c61676c8f43a80d009da16ed6f
3
+ metadata.gz: dc9119404c4a402c342aec3bfa812d34a8183b9f
4
+ data.tar.gz: '084e1b33e9441f66fb13d397f3887f9deafea987'
5
5
  SHA512:
6
- metadata.gz: 8e63d38edb9d7f6c23ce7399caf95a98fd69c83bf1b893fd6d1dd9a46e2c3cd0f6bb6123cddaa093f3a9e64f32d03ad5a721be676dada2f36a01296a33fe973a
7
- data.tar.gz: 00b73ca435f092abaa9c15ef6d9a22dbadbd20b55e34c17286b76b85d9aec6f39a63c63c707a9174ab7d54177986ae127a3ef6021ac8f6fc0e9de478a66c403a
6
+ metadata.gz: d1b25d26296524e0a65ae5fe48e9fdc3c6595ff7bedfca31c0d10fcdecb0e059a9210649816b92ac037b2bc0eedfd92e22404c0f021c2f98b46d59db769065eb
7
+ data.tar.gz: b09fe1f1a3b7c20cf7705335fbba740da4c022399434b6992b02b77db9e33bae1477a8aa9576cb4b045d633c74cb3d5e42b442312a2c722476d24b24f5fe2fa8
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Twitter
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -61,6 +61,26 @@ module OmniAuth
61
61
  old_request_phase
62
62
  end
63
63
 
64
+ alias :old_callback_url :callback_url
65
+
66
+ def callback_url
67
+ if request.params['callback_url']
68
+ request.params['callback_url']
69
+ else
70
+ old_callback_url
71
+ end
72
+ end
73
+
74
+ def callback_path
75
+ params = session['omniauth.params']
76
+
77
+ if params.nil? || params['callback_url'].nil?
78
+ super
79
+ else
80
+ URI(params['callback_url']).path
81
+ end
82
+ end
83
+
64
84
  private
65
85
 
66
86
  def image_url
@@ -130,6 +130,48 @@ describe OmniAuth::Strategies::Twitter do
130
130
  end
131
131
  end
132
132
 
133
+ context 'with a specified callback_url in the params' do
134
+ before do
135
+ params = { 'callback_url' => 'http://foo.dev/auth/twitter/foobar' }
136
+ allow(subject).to receive(:request) do
137
+ double('Request', :params => params)
138
+ end
139
+ allow(subject).to receive(:session) do
140
+ double('Session', :[] => { 'callback_url' => params['callback_url'] })
141
+ end
142
+ allow(subject).to receive(:old_request_phase) { :whatever }
143
+ end
144
+
145
+ it 'should use the callback_url' do
146
+ expect(subject.callback_url).to eq 'http://foo.dev/auth/twitter/foobar'
147
+ end
148
+
149
+ it 'should return the correct callback_path' do
150
+ expect(subject.callback_path).to eq '/auth/twitter/foobar'
151
+ end
152
+ end
153
+
154
+ context 'with no callback_url set' do
155
+ before do
156
+ allow(subject).to receive(:request) do
157
+ double('Request', :params => {})
158
+ end
159
+ allow(subject).to receive(:session) do
160
+ double('Session', :[] => {})
161
+ end
162
+ allow(subject).to receive(:old_request_phase) { :whatever }
163
+ allow(subject).to receive(:old_callback_url).and_return(:old_callback)
164
+ end
165
+
166
+ it 'callback_url should return nil' do
167
+ expect(subject.callback_url).to eq :old_callback
168
+ end
169
+
170
+ it 'should return the default callback_path value' do
171
+ expect(subject.callback_path).to eq '/auth/twitter/callback'
172
+ end
173
+ end
174
+
133
175
  context "with no request params set and force_login specified" do
134
176
  before do
135
177
  allow(subject).to receive(:request) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arun Agrawal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.5.2
95
+ rubygems_version: 2.6.8
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: OmniAuth strategy for Twitter