omniauth-icalia 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 864c313673647f747871ee2111f655b66c71a45868a0e176a7365eee7bbd40d0
4
- data.tar.gz: c88f092f924a9828dbdbe6d47bf7ecbd51ba937df3a29ef256a18ebe3ee7db73
3
+ metadata.gz: 639cd1645e7cf5c313a531d912ee22f9050ab57dac3cff0badd3042bd55fe249
4
+ data.tar.gz: 1925f26f026e334cc4274318f603563d6f1accb95cef046fcbb6e72f5f8299ea
5
5
  SHA512:
6
- metadata.gz: 5b5743a0b47f00ee0ed729c046da7d5286c598586d0b31a6d80495a0f739e22204ca6d2258a2d6c687f1f369cfbc7af2de6989c7d636c5c0adfa5d1087ba95e9
7
- data.tar.gz: 07e308c264cd88b65d299007c2977ea06c705e731adfa7fb59bc4fded03f89ed6d729b607b1b0e47547e3a8d2f675f022a53d2529369d47a77799641b0344938
6
+ metadata.gz: f37cf9a8b6572028d3ca09bf2f3d277d5689bf5a240e4cd42787f8f7744f5e9b809292fd7e7a1c475903f73f24cd17c79dbe6131c0cf8a54e75b91b2bbb23a74
7
+ data.tar.gz: ea3586542406a86fba4f17dccc6b0cae09a6df54be04b2d44a1e6886ecdf26ef6acf6fabae0a3d0d4c396638693bd900d193d24e93396c7819422b8c65e3c080
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Icalia
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'omniauth', '~> 1.5'
22
22
  spec.add_dependency 'omniauth-oauth2', '>= 1.4.0', '< 2.0'
23
- spec.add_dependency 'icalia-sdk-event-core', '~> 0.3.4', '>= 0.3.4'
23
+ spec.add_dependency 'icalia-sdk-event-core', '~> 0.3', '>= 0.3.5'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.17'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -0,0 +1,109 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe OmniAuth::Strategies::Icalia do
4
+ let(:access_token) { instance_double('AccessToken', :options => {}, :[] => 'user') }
5
+ let(:parsed_response) { instance_double('ParsedResponse') }
6
+ let(:response) { instance_double('Response', :parsed => parsed_response) }
7
+
8
+ let(:example_overridden_site) { 'https://example.com' }
9
+ let(:example_overridden_token_url) { 'https://example.com/oauth/token' }
10
+ let(:example_overridden_authorize_url) { 'https://example.com/oauth/authorize' }
11
+
12
+ let(:example_options) { {} }
13
+
14
+ subject do
15
+ OmniAuth::Strategies::Icalia.new 'ICALIA_CLIENT_KEY',
16
+ 'ICALIA_CLIENT_SECRET',
17
+ example_options
18
+ end
19
+
20
+ before :each do
21
+ allow(subject).to receive(:access_token).and_return(access_token)
22
+ end
23
+
24
+ describe 'client options' do
25
+ context 'defaults' do
26
+ it 'site is artanis' do
27
+ expect(subject.options.client_options.site).to eq 'https://artanis.icalialabs.com'
28
+ end
29
+
30
+ it 'authorize url is artanis authorize url' do
31
+ expect(subject.options.client_options.authorize_url).to eq 'https://artanis.icalialabs.com/oauth/authorize'
32
+ end
33
+
34
+ it 'token url is artanis token url' do
35
+ expect(subject.options.client_options.token_url).to eq 'https://artanis.icalialabs.com/oauth/token'
36
+ end
37
+ end
38
+
39
+ context 'overrides' do
40
+ let :example_options do
41
+ {
42
+ client_options: {
43
+ site: example_overridden_site,
44
+ token_url: example_overridden_token_url,
45
+ authorize_url: example_overridden_authorize_url,
46
+ }
47
+ }
48
+ end
49
+
50
+ it 'allows overriding the site' do
51
+ expect(subject.options.client_options.site)
52
+ .to eq example_overridden_site
53
+ end
54
+
55
+ it 'allows overriding the authorize url' do
56
+ expect(subject.options.client_options.authorize_url)
57
+ .to eq example_overridden_authorize_url
58
+ end
59
+
60
+ it 'allows overriding the token url' do
61
+ expect(subject.options.client_options.token_url)
62
+ .to eq example_overridden_token_url
63
+ end
64
+ end
65
+ end
66
+
67
+ describe '#raw_info', skip: true do
68
+ it 'should use relative paths' do
69
+ expect(access_token).to receive(:get).with('/oauth/token/info?include=resource-owner.email-accounts').and_return(response)
70
+ expect(subject.raw_info).to eq(parsed_response)
71
+ end
72
+
73
+ it 'should use the header auth mode' do
74
+ expect(access_token).to receive(:get).with('user').and_return(response)
75
+ subject.raw_info
76
+ expect(access_token.options[:mode]).to eq(:header)
77
+ end
78
+ end
79
+
80
+ describe '#info.email', skip: true do
81
+ it 'should use any available email' do
82
+ allow(subject).to receive(:raw_info).and_return({})
83
+ allow(subject).to receive(:email).and_return('you@example.com')
84
+ expect(subject.info['email']).to eq('you@example.com')
85
+ end
86
+ end
87
+
88
+ context '#info.urls', skip: true do
89
+ it 'should use html_url from raw_info' do
90
+ allow(subject).to receive(:raw_info).and_return({ 'login' => 'me', 'html_url' => 'http://enterprise/me' })
91
+ expect(subject.info['urls']['icalia']).to eq('http://enterprise/me')
92
+ end
93
+ end
94
+
95
+ context '#extra.scope' do
96
+ it 'returns the scope on the returned access_token' do
97
+ expect(subject.scope).to eq('user')
98
+ end
99
+ end
100
+
101
+ describe '#callback_url' do
102
+ it 'is a combination of host, script name, and callback path' do
103
+ allow(subject).to receive(:full_host).and_return('https://example.com')
104
+ allow(subject).to receive(:script_name).and_return('/sub_uri')
105
+
106
+ expect(subject.callback_url).to eq('https://example.com/sub_uri/auth/icalia/callback')
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,14 @@
1
+ require 'bundler/setup'
2
+ require 'omniauth-icalia'
3
+
4
+ RSpec.configure do |config|
5
+ # Enable flags like --only-failures and --next-failure
6
+ config.example_status_persistence_file_path = 'examples.txt'
7
+
8
+ # Disable RSpec exposing methods globally on `Module` and `main`
9
+ config.disable_monkey_patching!
10
+
11
+ config.expect_with :rspec do |c|
12
+ c.syntax = :expect
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-icalia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
@@ -48,22 +48,22 @@ dependencies:
48
48
  name: icalia-sdk-event-core
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 0.3.4
54
51
  - - "~>"
55
52
  - !ruby/object:Gem::Version
56
- version: 0.3.4
53
+ version: '0.3'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.3.5
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: 0.3.4
64
61
  - - "~>"
65
62
  - !ruby/object:Gem::Version
66
- version: 0.3.4
63
+ version: '0.3'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 0.3.5
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: bundler
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -125,6 +125,8 @@ files:
125
125
  - lib/omniauth-icalia/version.rb
126
126
  - lib/omniauth/strategies/icalia.rb
127
127
  - omniauth-icalia.gemspec
128
+ - spec/omniauth/strategies/icalia_spec.rb
129
+ - spec/spec_helper.rb
128
130
  homepage: https://github.com/IcaliaLabs/omniauth-icalia
129
131
  licenses:
130
132
  - MIT
@@ -148,4 +150,6 @@ rubygems_version: 3.0.3
148
150
  signing_key:
149
151
  specification_version: 4
150
152
  summary: Official Omniauth Strategy for Icalia.
151
- test_files: []
153
+ test_files:
154
+ - spec/omniauth/strategies/icalia_spec.rb
155
+ - spec/spec_helper.rb