omniauth-mlh 1.0.0 → 1.0.1
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 +4 -4
- data/.github/workflows/gem-push.yml +30 -0
- data/.github/workflows/test.yml +30 -0
- data/.rubocop.yml +25 -9
- data/.travis.yml +1 -1
- data/CONTRIBUTING.md +27 -0
- data/Gemfile +2 -0
- data/README.md +5 -8
- data/Rakefile +4 -0
- data/lib/omniauth/strategies/mlh.rb +1 -1
- data/lib/omniauth-mlh/version.rb +1 -1
- data/lib/{omniauth-mlh.rb → omniauth_mlh.rb} +0 -1
- data/omniauth-mlh.gemspec +8 -8
- data/spec/omni_auth/mlh_spec.rb +39 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/shared_examples.rb +12 -7
- metadata +54 -40
- data/spec/omniauth/mlh_spec.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8a63e3530dc45956b6373c50995939ce8ea698a3118c473a0a5d497fb75ed55
|
4
|
+
data.tar.gz: 14a9fa6f3ee6eb9d26b4496fe0678f17aa805eaf1b15457cc13f172e698ada6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525b5b9983beda5ed9c922e451430f7c6ead1d3ce508fddfd6f2616eab46de12772540d4252a1db6ed632b39a6b388ce35dbb3ba28ef108633f7e38bd3a73102
|
7
|
+
data.tar.gz: 9ec5f8644840ceeb01267be362bf26f7cec1e36853611c718ffe46b9a2e48fb9b6c0804c242c65f8612dfde7da80915bbd5d940bcee63c06e6dcf1a25c47ac12
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Push Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- name: Set up Ruby 3.2
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: '3.2'
|
19
|
+
bundler-cache: true
|
20
|
+
|
21
|
+
- name: Publish to RubyGems
|
22
|
+
run: |
|
23
|
+
mkdir -p $HOME/.gem
|
24
|
+
touch $HOME/.gem/credentials
|
25
|
+
chmod 0600 $HOME/.gem/credentials
|
26
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
27
|
+
gem build *.gemspec
|
28
|
+
gem push *.gem
|
29
|
+
env:
|
30
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- 'main'
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- 'main'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby: ['2.7', '3.2']
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- name: Install dependencies
|
24
|
+
run: |
|
25
|
+
gem install bundler
|
26
|
+
bundle install
|
27
|
+
- name: Run Spec
|
28
|
+
run: bundle exec rake spec
|
29
|
+
- name: Run Rubocop
|
30
|
+
run: bundle exec rake rubocop
|
data/.rubocop.yml
CHANGED
@@ -1,12 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-performance
|
3
4
|
|
4
|
-
|
5
|
+
AllCops:
|
6
|
+
# Ruby 2.7 is the MINIMUM Ruby version supported
|
7
|
+
TargetRubyVersion: '2.7.0'
|
5
8
|
Exclude:
|
6
|
-
-
|
9
|
+
- vendor/**/*
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
Style/WordArray:
|
12
|
+
Description: Force arrays of words to use bracket notation instead of %w
|
13
|
+
EnforcedStyle: brackets
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
Style/SymbolArray:
|
17
|
+
Description: Force symbol arrays to use bracket notation instead of %i
|
18
|
+
EnforcedStyle: brackets
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
Style/RegexpLiteral:
|
22
|
+
Description: Allow forward slashes within regular expressions
|
23
|
+
AllowInnerSlashes: true
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
RSpec/MultipleExpectations:
|
27
|
+
Description: Allow tests to contain multiple expectations
|
28
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Contributing Guidelines
|
2
|
+
|
3
|
+
Thank you for considering contributing to omniauth-mlh.
|
4
|
+
|
5
|
+
## Contributor Checklist
|
6
|
+
|
7
|
+
- Fork the Repo ( https://github.com/mlh/omniauth-mlh/fork )
|
8
|
+
- Create your feature branch (`git checkout -b my-new-feature`)
|
9
|
+
- Commit your changes (`git commit -am 'Add some feature'`)
|
10
|
+
- Push to the branch (`git push origin my-new-feature`)
|
11
|
+
- Create a new Pull Request
|
12
|
+
|
13
|
+
### Running tests
|
14
|
+
|
15
|
+
Following command can be used to run the test
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ bundle exec rake spec
|
19
|
+
```
|
20
|
+
|
21
|
+
## Code quality tools
|
22
|
+
|
23
|
+
Code quality is enforced across the entire gem with Rubocop:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ bundle exec rubocop
|
27
|
+
```
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# MLH/
|
1
|
+
# MLH/omniauth-mlh
|
2
2
|
|
3
|
-
[](https://github.com/MLH/omniauth-mlh/actions/workflows/test.yml)
|
4
4
|
|
5
5
|
This is the official [OmniAuth](https://github.com/omniauth/omniauth) strategy for
|
6
6
|
authenticating with [MyMLH](https://my.mlh.io). To use it, you'll need to
|
@@ -12,7 +12,8 @@ Once you have done so, you can follow the instructions below:
|
|
12
12
|
|
13
13
|
## Requirements
|
14
14
|
|
15
|
-
|
15
|
+
This Gem requires your Ruby version to be at least `2.2.0`, which is set
|
16
|
+
downstream by [Omniauth](https://github.com/omniauth/omniauth/blob/master/omniauth.gemspec#L22).
|
16
17
|
|
17
18
|
## Installation
|
18
19
|
|
@@ -50,11 +51,7 @@ end
|
|
50
51
|
|
51
52
|
## Contributing
|
52
53
|
|
53
|
-
|
54
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
-
5. Create a new Pull Request
|
54
|
+
For guidance on setting up a development environment and how to make a contribution to omniauth-mlh, see the [contributing guidelines](https://github.com/MLH/omniauth-mlh/blob/main/CONTRIBUTING.md).
|
58
55
|
|
59
56
|
## Credit
|
60
57
|
|
data/Rakefile
CHANGED
data/lib/omniauth-mlh/version.rb
CHANGED
data/omniauth-mlh.gemspec
CHANGED
@@ -8,15 +8,15 @@ require 'omniauth-mlh/version'
|
|
8
8
|
Gem::Specification.new do |spec|
|
9
9
|
spec.name = 'omniauth-mlh'
|
10
10
|
spec.version = OmniAuth::MLH::VERSION
|
11
|
-
spec.authors = ['
|
12
|
-
spec.email = ['
|
11
|
+
spec.authors = ['Major League Hacking (MLH)']
|
12
|
+
spec.email = ['hi@mlh.io']
|
13
13
|
|
14
14
|
spec.summary = 'Official OmniAuth strategy for MyMLH.'
|
15
15
|
spec.description = 'Official OmniAuth strategy for MyMLH.'
|
16
16
|
spec.homepage = 'http://github.com/mlh/omniauth-mlh'
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
|
-
spec.required_ruby_version = '>= 2.
|
19
|
+
spec.required_ruby_version = '>= 2.7.0'
|
20
20
|
|
21
21
|
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
22
22
|
spec.files = `git ls-files`.split("\n")
|
@@ -26,13 +26,13 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'oauth2', '~> 2.0.9'
|
27
27
|
spec.add_dependency 'omniauth', '~> 2.1.1'
|
28
28
|
spec.add_dependency 'omniauth-oauth2', '~> 1.8.0'
|
29
|
-
spec.add_dependency 'omniauth-rails_csrf_protection', '~> 1.0.1'
|
30
|
-
|
31
|
-
spec.add_dependency 'activesupport'
|
32
29
|
|
33
30
|
spec.add_development_dependency 'rack-test'
|
34
|
-
spec.add_development_dependency 'rake', '~>
|
35
|
-
spec.add_development_dependency 'rspec', '~>
|
31
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
34
|
+
spec.add_development_dependency 'rubocop-performance'
|
35
|
+
spec.add_development_dependency 'rubocop-rspec'
|
36
36
|
spec.add_development_dependency 'simplecov'
|
37
37
|
spec.add_development_dependency 'webmock'
|
38
38
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe OmniAuth::MLH do
|
6
|
+
subject(:omniauth_mlh) do
|
7
|
+
# The instance variable @options is being used to pass options to the subject of the shared examples
|
8
|
+
OmniAuth::Strategies::MLH.new(nil, @options || {}) # rubocop:disable RSpec/InstanceVariable
|
9
|
+
end
|
10
|
+
|
11
|
+
it_behaves_like 'an oauth2 strategy'
|
12
|
+
|
13
|
+
describe '#client' do
|
14
|
+
it 'has correct MyMLH site' do
|
15
|
+
expect(omniauth_mlh.client.site).to eq('https://my.mlh.io')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'has correct authorize url' do
|
19
|
+
expect(omniauth_mlh.client.options[:authorize_url]).to eq('oauth/authorize')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'has correct token url' do
|
23
|
+
expect(omniauth_mlh.client.options[:token_url]).to eq('oauth/token')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'runs the setup block if passed one' do
|
27
|
+
counter = ''
|
28
|
+
@options = { setup: proc { |_env| counter = 'ok' } }
|
29
|
+
omniauth_mlh.setup_phase
|
30
|
+
expect(counter).to eq('ok')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#callback_path' do
|
35
|
+
it 'has the correct callback path' do
|
36
|
+
expect(omniauth_mlh.callback_path).to eq('/auth/mlh/callback')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,35 +5,40 @@
|
|
5
5
|
|
6
6
|
shared_examples 'an oauth2 strategy' do
|
7
7
|
describe '#client' do
|
8
|
-
it '
|
8
|
+
it 'is initialized with symbolized client_options' do
|
9
9
|
@options = { client_options: { 'authorize_url' => 'https://example.com' } }
|
10
|
+
|
10
11
|
expect(subject.client.options[:authorize_url]).to eq('https://example.com')
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
15
|
describe '#authorize_params' do
|
15
|
-
it '
|
16
|
+
it 'includes any authorize params passed in the :authorize_params option' do
|
16
17
|
@options = { authorize_params: { foo: 'bar', baz: 'zip' } }
|
18
|
+
|
17
19
|
expect(subject.authorize_params['foo']).to eq('bar')
|
18
20
|
expect(subject.authorize_params['baz']).to eq('zip')
|
19
21
|
end
|
20
22
|
|
21
|
-
it '
|
22
|
-
@options = { authorize_options:
|
23
|
+
it 'includes top-level options that are marked as :authorize_options' do
|
24
|
+
@options = { authorize_options: ['scope', 'foo'], scope: 'bar', foo: 'baz' }
|
25
|
+
|
23
26
|
expect(subject.authorize_params['scope']).to eq('bar')
|
24
27
|
expect(subject.authorize_params['foo']).to eq('baz')
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
28
31
|
describe '#token_params' do
|
29
|
-
it '
|
32
|
+
it 'includes any token params passed in the :token_params option' do
|
30
33
|
@options = { token_params: { foo: 'bar', baz: 'zip' } }
|
34
|
+
|
31
35
|
expect(subject.token_params['foo']).to eq('bar')
|
32
36
|
expect(subject.token_params['baz']).to eq('zip')
|
33
37
|
end
|
34
38
|
|
35
|
-
it '
|
36
|
-
@options = { token_options:
|
39
|
+
it 'includes top-level options that are marked as :token_options' do
|
40
|
+
@options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
|
41
|
+
|
37
42
|
expect(subject.token_params['scope']).to eq('bar')
|
38
43
|
expect(subject.token_params['foo']).to eq('baz')
|
39
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-mlh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Major League Hacking (MLH)
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -53,75 +53,89 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rack-test
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
type: :
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
-
type: :
|
75
|
+
version: 12.3.3
|
76
|
+
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 12.3.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '3.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '3.10'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rubocop-performance
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: simplecov
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,31 +166,34 @@ dependencies:
|
|
152
166
|
version: '0'
|
153
167
|
description: Official OmniAuth strategy for MyMLH.
|
154
168
|
email:
|
155
|
-
-
|
169
|
+
- hi@mlh.io
|
156
170
|
executables: []
|
157
171
|
extensions: []
|
158
172
|
extra_rdoc_files: []
|
159
173
|
files:
|
174
|
+
- ".github/workflows/gem-push.yml"
|
175
|
+
- ".github/workflows/test.yml"
|
160
176
|
- ".gitignore"
|
161
177
|
- ".rspec"
|
162
178
|
- ".rubocop.yml"
|
163
179
|
- ".travis.yml"
|
180
|
+
- CONTRIBUTING.md
|
164
181
|
- Gemfile
|
165
182
|
- LICENSE.txt
|
166
183
|
- README.md
|
167
184
|
- Rakefile
|
168
|
-
- lib/omniauth-mlh.rb
|
169
185
|
- lib/omniauth-mlh/version.rb
|
170
186
|
- lib/omniauth/strategies/mlh.rb
|
187
|
+
- lib/omniauth_mlh.rb
|
171
188
|
- omniauth-mlh.gemspec
|
172
|
-
- spec/
|
189
|
+
- spec/omni_auth/mlh_spec.rb
|
173
190
|
- spec/spec_helper.rb
|
174
191
|
- spec/support/shared_examples.rb
|
175
192
|
homepage: http://github.com/mlh/omniauth-mlh
|
176
193
|
licenses:
|
177
194
|
- MIT
|
178
195
|
metadata: {}
|
179
|
-
post_install_message:
|
196
|
+
post_install_message:
|
180
197
|
rdoc_options: []
|
181
198
|
require_paths:
|
182
199
|
- lib
|
@@ -184,18 +201,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
201
|
requirements:
|
185
202
|
- - ">="
|
186
203
|
- !ruby/object:Gem::Version
|
187
|
-
version: 2.
|
204
|
+
version: 2.7.0
|
188
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
206
|
requirements:
|
190
207
|
- - ">="
|
191
208
|
- !ruby/object:Gem::Version
|
192
209
|
version: '0'
|
193
210
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
195
|
-
signing_key:
|
211
|
+
rubygems_version: 3.4.10
|
212
|
+
signing_key:
|
196
213
|
specification_version: 4
|
197
214
|
summary: Official OmniAuth strategy for MyMLH.
|
198
|
-
test_files:
|
199
|
-
- spec/omniauth/mlh_spec.rb
|
200
|
-
- spec/spec_helper.rb
|
201
|
-
- spec/support/shared_examples.rb
|
215
|
+
test_files: []
|
data/spec/omniauth/mlh_spec.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe OmniAuth::MLH do
|
6
|
-
subject do
|
7
|
-
OmniAuth::Strategies::MLH.new(nil, @options || {})
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like 'an oauth2 strategy'
|
11
|
-
|
12
|
-
describe '#client' do
|
13
|
-
it 'has correct MyMLH site' do
|
14
|
-
expect(subject.client.site).to eq('https://my.mlh.io')
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has correct authorize url' do
|
18
|
-
expect(subject.client.options[:authorize_url]).to eq('oauth/authorize')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'has correct token url' do
|
22
|
-
expect(subject.client.options[:token_url]).to eq('oauth/token')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'runs the setup block if passed one' do
|
26
|
-
counter = ''
|
27
|
-
@options = { setup: proc { |_env| counter = 'ok' } }
|
28
|
-
subject.setup_phase
|
29
|
-
expect(counter).to eq('ok')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#callback_path' do
|
34
|
-
it 'has the correct callback path' do
|
35
|
-
expect(subject.callback_path).to eq('/auth/mlh/callback')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|