Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update github actions config #88

Merged
merged 10 commits into from
Sep 26, 2022
16 changes: 9 additions & 7 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ on:
- master
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['2.5', '2.6', '2.7']
ruby: ['2.6', '2.7', '3.0', '3.1']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby }}
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Build and test with Rake on Ruby ${{ matrix.ruby }}
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rake spec
run: bundle exec rake spec
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/apple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def authorize_params
end

def callback_url
options[:redirect_uri] || (full_host + script_name + callback_path)
options[:redirect_uri] || (full_host + callback_path)
end

private
Expand Down
3 changes: 2 additions & 1 deletion omniauth-apple.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ Gem::Specification.new do |spec|

spec.add_dependency 'omniauth-oauth2'
spec.add_dependency 'jwt'
spec.add_dependency 'rack-protection', '~> 2.0'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec", "~> 3.9"
spec.add_development_dependency "webmock", "~> 3.8"
spec.add_development_dependency 'simplecov', "~> 0.18"
spec.add_development_dependency "simplecov", "~> 0.18"
end
18 changes: 18 additions & 0 deletions spec/omniauth/strategies/apple_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,31 @@
end
end

describe '#callback_url' do
let(:base_url) { 'https://example.com' }

it 'has the correct default callback path' do
allow(subject).to receive(:full_host) { base_url }
allow(subject).to receive(:script_name) { '' }
expect(subject.send(:callback_url)).to eq(base_url + '/auth/apple/callback')
end

it 'should set the callback path with script_name if present' do
allow(subject).to receive(:full_host) { base_url }
allow(subject).to receive(:script_name) { '/v1' }
expect(subject.send(:callback_url)).to eq(base_url + '/v1/auth/apple/callback')
end
end

describe '#callback_path' do
it 'has the correct default callback path' do
subject.authorize_params # initializes env, session (for test_mode) and populates 'nonce', 'state'
expect(subject.callback_path).to eq('/auth/apple/callback')
end

it 'should set the callback_path parameter if present' do
options.merge!(callback_path: '/auth/foo/callback')
subject.authorize_params # initializes env, session (for test_mode) and populates 'nonce', 'state'
expect(subject.callback_path).to eq('/auth/foo/callback')
end
end
Expand Down