omniauth-rightsignature 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,145 @@
1
+ require 'helper'
2
+
3
+ describe OmniAuth do
4
+ describe '.strategies' do
5
+ it 'increases when a new strategy is made' do
6
+ expect do
7
+ class ExampleStrategy
8
+ include OmniAuth::Strategy
9
+ end
10
+ end.to change(OmniAuth.strategies, :size).by(1)
11
+ expect(OmniAuth.strategies.last).to eq(ExampleStrategy)
12
+ end
13
+ end
14
+
15
+ context 'configuration' do
16
+ describe '.defaults' do
17
+ it 'is a hash of default configuration' do
18
+ expect(OmniAuth::Configuration.defaults).to be_kind_of(Hash)
19
+ end
20
+ end
21
+
22
+ it 'is callable from .configure' do
23
+ OmniAuth.configure do |c|
24
+ expect(c).to be_kind_of(OmniAuth::Configuration)
25
+ end
26
+ end
27
+
28
+ before do
29
+ @old_path_prefix = OmniAuth.config.path_prefix
30
+ @old_on_failure = OmniAuth.config.on_failure
31
+ @old_before_callback_phase = OmniAuth.config.before_callback_phase
32
+ @old_before_options_phase = OmniAuth.config.before_options_phase
33
+ @old_before_request_phase = OmniAuth.config.before_request_phase
34
+ end
35
+
36
+ after do
37
+ OmniAuth.configure do |config|
38
+ config.path_prefix = @old_path_prefix
39
+ config.on_failure = @old_on_failure
40
+ config.before_callback_phase = @old_before_callback_phase
41
+ config.before_options_phase = @old_before_options_phase
42
+ config.before_request_phase = @old_before_request_phase
43
+ end
44
+ end
45
+
46
+ it 'is able to set the path' do
47
+ OmniAuth.configure do |config|
48
+ config.path_prefix = '/awesome'
49
+ end
50
+
51
+ expect(OmniAuth.config.path_prefix).to eq('/awesome')
52
+ end
53
+
54
+ it 'is able to set the on_failure rack app' do
55
+ OmniAuth.configure do |config|
56
+ config.on_failure do
57
+ 'yoyo'
58
+ end
59
+ end
60
+
61
+ expect(OmniAuth.config.on_failure.call).to eq('yoyo')
62
+ end
63
+
64
+ it 'is able to set hook on option_call' do
65
+ OmniAuth.configure do |config|
66
+ config.before_options_phase do
67
+ 'yoyo'
68
+ end
69
+ end
70
+ expect(OmniAuth.config.before_options_phase.call).to eq('yoyo')
71
+ end
72
+
73
+ it 'is able to set hook on request_call' do
74
+ OmniAuth.configure do |config|
75
+ config.before_request_phase do
76
+ 'heyhey'
77
+ end
78
+ end
79
+ expect(OmniAuth.config.before_request_phase.call).to eq('heyhey')
80
+ end
81
+
82
+ it 'is able to set hook on callback_call' do
83
+ OmniAuth.configure do |config|
84
+ config.before_callback_phase do
85
+ 'heyhey'
86
+ end
87
+ end
88
+ expect(OmniAuth.config.before_callback_phase.call).to eq('heyhey')
89
+ end
90
+
91
+ describe 'mock auth' do
92
+ before do
93
+ OmniAuth.config.add_mock(:facebook, :uid => '12345', :info => {:name => 'Joe', :email => 'joe@example.com'})
94
+ end
95
+ it 'default is AuthHash' do
96
+ OmniAuth.configure do |config|
97
+ expect(config.mock_auth[:default]).to be_kind_of(OmniAuth::AuthHash)
98
+ end
99
+ end
100
+ it 'facebook is AuthHash' do
101
+ OmniAuth.configure do |config|
102
+ expect(config.mock_auth[:facebook]).to be_kind_of(OmniAuth::AuthHash)
103
+ end
104
+ end
105
+ it 'sets facebook attributes' do
106
+ OmniAuth.configure do |config|
107
+ expect(config.mock_auth[:facebook].uid).to eq('12345')
108
+ expect(config.mock_auth[:facebook].info.name).to eq('Joe')
109
+ expect(config.mock_auth[:facebook].info.email).to eq('joe@example.com')
110
+ end
111
+ end
112
+ end
113
+ end
114
+
115
+ describe '.logger' do
116
+ it 'calls through to the configured logger' do
117
+ allow(OmniAuth).to receive(:config).and_return(double(:logger => 'foo'))
118
+ expect(OmniAuth.logger).to eq('foo')
119
+ end
120
+ end
121
+
122
+ describe '::Utils' do
123
+ describe '.deep_merge' do
124
+ it 'combines hashes' do
125
+ expect(OmniAuth::Utils.deep_merge({'abc' => {'def' => 123}}, 'abc' => {'foo' => 'bar'})).to eq('abc' => {'def' => 123, 'foo' => 'bar'})
126
+ end
127
+ end
128
+
129
+ describe '.camelize' do
130
+ it 'works on normal cases' do
131
+ {
132
+ 'some_word' => 'SomeWord',
133
+ 'AnotherWord' => 'AnotherWord',
134
+ 'one' => 'One',
135
+ 'three_words_now' => 'ThreeWordsNow',
136
+ }.each_pair { |k, v| expect(OmniAuth::Utils.camelize(k)).to eq(v) }
137
+ end
138
+
139
+ it 'works in special cases that have been added' do
140
+ OmniAuth.config.add_camelization('oauth', 'OAuth')
141
+ expect(OmniAuth::Utils.camelize(:oauth)).to eq('OAuth')
142
+ end
143
+ end
144
+ end
145
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-rightsignature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepikaa Subramaniam
@@ -113,8 +113,40 @@ email: deepikaa.subramaniam@citrix.com
113
113
  executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
- files: []
117
- homepage:
116
+ files:
117
+ - ".gitignore"
118
+ - ".rspec"
119
+ - ".rubocop.yml"
120
+ - ".travis.yml"
121
+ - ".yardopts"
122
+ - Gemfile
123
+ - Gemfile.rack-1.3.x
124
+ - Guardfile
125
+ - LICENSE.md
126
+ - README.md
127
+ - Rakefile
128
+ - lib/omniauth-rightsignature.rb
129
+ - lib/omniauth.rb
130
+ - lib/omniauth/auth_hash.rb
131
+ - lib/omniauth/builder.rb
132
+ - lib/omniauth/failure_endpoint.rb
133
+ - lib/omniauth/form.css
134
+ - lib/omniauth/form.rb
135
+ - lib/omniauth/rightsignature/version.rb
136
+ - lib/omniauth/strategies/rightsignature.rb
137
+ - lib/omniauth/strategy.rb
138
+ - lib/omniauth/test.rb
139
+ - lib/omniauth/version.rb
140
+ - omniauth-rightsignature.gemspec
141
+ - spec/helper.rb
142
+ - spec/omniauth/auth_hash_spec.rb
143
+ - spec/omniauth/builder_spec.rb
144
+ - spec/omniauth/failure_endpoint_spec.rb
145
+ - spec/omniauth/form_spec.rb
146
+ - spec/omniauth/strategies/developer_spec.rb
147
+ - spec/omniauth/strategy_spec.rb
148
+ - spec/omniauth_spec.rb
149
+ homepage: https://github.com/DeepikaaSubramaniam21/omniauth-rightsignature/
118
150
  licenses: []
119
151
  metadata: {}
120
152
  post_install_message: