New upstream version 1.4.0
Sruthi Chandran
5 years ago
0 | dist: trusty | |
1 | ||
0 | 2 | rvm: |
1 | - 1.9.3 | |
2 | - 2.0.0 | |
3 | - 2.1 | |
4 | - 2.2 | |
5 | - jruby | |
6 | - rbx-2 | |
3 | - 2.1.10 | |
4 | - 2.2.6 | |
5 | - 2.3.3 | |
6 | - 2.4.0 | |
7 | - jruby-1.7.26 | |
8 | - rbx-3 | |
9 | ||
10 | matrix: | |
11 | allow_failures: | |
12 | - rvm: rbx-3 |
4 | 4 | gem 'rake' |
5 | 5 | |
6 | 6 | group :test do |
7 | if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.0.0") | |
8 | # for jruby 1.7.x | |
9 | gem "addressable", "2.4.0" | |
10 | end | |
11 | ||
12 | if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2") | |
13 | gem "rack", "~> 1.6" | |
14 | end | |
15 | ||
7 | 16 | gem 'rspec', '~> 3.2' |
8 | 17 | gem 'rack-test' |
9 | 18 | gem 'simplecov' |
155 | 155 | |
156 | 156 | ## Supported Rubies |
157 | 157 | |
158 | OmniAuth Twitter is tested under 1.9.3, 2.0.0, 2.1.x, 2.2.x, JRuby, and Rubinius. | |
158 | OmniAuth Twitter is tested under 2.1.x, 2.2.x and JRuby. | |
159 | ||
160 | If you use its gem on ruby 1.9.x, 2.0.x, or Rubinius use version v1.2.1 . | |
159 | 161 | |
160 | 162 | ## Contributing |
161 | 163 |
60 | 60 | old_request_phase |
61 | 61 | end |
62 | 62 | |
63 | alias :old_callback_url :callback_url | |
64 | ||
65 | def callback_url | |
66 | if request.params['callback_url'] | |
67 | request.params['callback_url'] | |
68 | else | |
69 | old_callback_url | |
70 | end | |
71 | end | |
72 | ||
73 | def callback_path | |
74 | params = session['omniauth.params'] | |
75 | ||
76 | if params.nil? || params['callback_url'].nil? | |
77 | super | |
78 | else | |
79 | URI(params['callback_url']).path | |
80 | end | |
81 | end | |
82 | ||
63 | 83 | private |
64 | 84 | |
65 | 85 | def image_url |
0 | --- !ruby/object:Gem::Specification | |
1 | name: omniauth-twitter | |
2 | version: !ruby/object:Gem::Version | |
3 | version: 1.2.1 | |
4 | platform: ruby | |
5 | authors: | |
6 | - Arun Agrawal | |
7 | autorequire: | |
8 | bindir: bin | |
9 | cert_chain: [] | |
10 | date: 2015-07-29 00:00:00.000000000 Z | |
11 | dependencies: | |
12 | - !ruby/object:Gem::Dependency | |
13 | name: json | |
14 | requirement: !ruby/object:Gem::Requirement | |
15 | requirements: | |
16 | - - "~>" | |
17 | - !ruby/object:Gem::Version | |
18 | version: '1.3' | |
19 | type: :runtime | |
20 | prerelease: false | |
21 | version_requirements: !ruby/object:Gem::Requirement | |
22 | requirements: | |
23 | - - "~>" | |
24 | - !ruby/object:Gem::Version | |
25 | version: '1.3' | |
26 | - !ruby/object:Gem::Dependency | |
27 | name: omniauth-oauth | |
28 | requirement: !ruby/object:Gem::Requirement | |
29 | requirements: | |
30 | - - "~>" | |
31 | - !ruby/object:Gem::Version | |
32 | version: '1.1' | |
33 | type: :runtime | |
34 | prerelease: false | |
35 | version_requirements: !ruby/object:Gem::Requirement | |
36 | requirements: | |
37 | - - "~>" | |
38 | - !ruby/object:Gem::Version | |
39 | version: '1.1' | |
40 | - !ruby/object:Gem::Dependency | |
41 | name: bundler | |
42 | requirement: !ruby/object:Gem::Requirement | |
43 | requirements: | |
44 | - - "~>" | |
45 | - !ruby/object:Gem::Version | |
46 | version: '1.0' | |
47 | type: :development | |
48 | prerelease: false | |
49 | version_requirements: !ruby/object:Gem::Requirement | |
50 | requirements: | |
51 | - - "~>" | |
52 | - !ruby/object:Gem::Version | |
53 | version: '1.0' | |
54 | description: OmniAuth strategy for Twitter | |
55 | email: | |
56 | - arunagw@gmail.com | |
57 | executables: [] | |
58 | extensions: [] | |
59 | extra_rdoc_files: [] | |
60 | files: | |
61 | - ".gitignore" | |
62 | - ".rspec" | |
63 | - ".travis.yml" | |
64 | - CONTRIBUTING.md | |
65 | - Gemfile | |
66 | - README.md | |
67 | - Rakefile | |
68 | - lib/omniauth-twitter.rb | |
69 | - lib/omniauth-twitter/version.rb | |
70 | - lib/omniauth/strategies/twitter.rb | |
71 | - omniauth-twitter.gemspec | |
72 | - spec/omniauth/strategies/twitter_spec.rb | |
73 | - spec/spec_helper.rb | |
74 | homepage: https://github.com/arunagw/omniauth-twitter | |
75 | licenses: | |
76 | - MIT | |
77 | metadata: {} | |
78 | post_install_message: | |
79 | rdoc_options: [] | |
80 | require_paths: | |
81 | - lib | |
82 | required_ruby_version: !ruby/object:Gem::Requirement | |
83 | requirements: | |
84 | - - ">=" | |
85 | - !ruby/object:Gem::Version | |
86 | version: '0' | |
87 | required_rubygems_version: !ruby/object:Gem::Requirement | |
88 | requirements: | |
89 | - - ">=" | |
90 | - !ruby/object:Gem::Version | |
91 | version: '0' | |
92 | requirements: [] | |
93 | rubyforge_project: | |
94 | rubygems_version: 2.4.5 | |
95 | signing_key: | |
96 | specification_version: 4 | |
97 | summary: OmniAuth strategy for Twitter | |
98 | test_files: | |
99 | - spec/omniauth/strategies/twitter_spec.rb | |
100 | - spec/spec_helper.rb |
15 | 15 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") |
16 | 16 | s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } |
17 | 17 | s.require_paths = ["lib"] |
18 | ||
19 | s.add_dependency 'json', '~> 1.3' | |
18 | s.required_ruby_version = Gem::Requirement.new('>= 1.9.3') | |
20 | 19 | s.add_dependency 'omniauth-oauth', '~> 1.1' |
20 | s.add_dependency 'rack' | |
21 | 21 | s.add_development_dependency 'bundler', '~> 1.0' |
22 | 22 | end |
126 | 126 | |
127 | 127 | it "should switch authorize_path from authenticate to authorize" do |
128 | 128 | expect { subject.request_phase }.to change { subject.options.client_options.authorize_path }.from('/oauth/authenticate').to('/oauth/authorize') |
129 | end | |
130 | end | |
131 | ||
132 | context 'with a specified callback_url in the params' do | |
133 | before do | |
134 | params = { 'callback_url' => 'http://foo.dev/auth/twitter/foobar' } | |
135 | allow(subject).to receive(:request) do | |
136 | double('Request', :params => params) | |
137 | end | |
138 | allow(subject).to receive(:session) do | |
139 | double('Session', :[] => { 'callback_url' => params['callback_url'] }) | |
140 | end | |
141 | allow(subject).to receive(:old_request_phase) { :whatever } | |
142 | end | |
143 | ||
144 | it 'should use the callback_url' do | |
145 | expect(subject.callback_url).to eq 'http://foo.dev/auth/twitter/foobar' | |
146 | end | |
147 | ||
148 | it 'should return the correct callback_path' do | |
149 | expect(subject.callback_path).to eq '/auth/twitter/foobar' | |
150 | end | |
151 | end | |
152 | ||
153 | context 'with no callback_url set' do | |
154 | before do | |
155 | allow(subject).to receive(:request) do | |
156 | double('Request', :params => {}) | |
157 | end | |
158 | allow(subject).to receive(:session) do | |
159 | double('Session', :[] => {}) | |
160 | end | |
161 | allow(subject).to receive(:old_request_phase) { :whatever } | |
162 | allow(subject).to receive(:old_callback_url).and_return(:old_callback) | |
163 | end | |
164 | ||
165 | it 'callback_url should return nil' do | |
166 | expect(subject.callback_url).to eq :old_callback | |
167 | end | |
168 | ||
169 | it 'should return the default callback_path value' do | |
170 | expect(subject.callback_path).to eq '/auth/twitter/callback' | |
129 | 171 | end |
130 | 172 | end |
131 | 173 |