Skip to content

Commit

Permalink
Merge pull request #4 from assaydepot/gha
Browse files Browse the repository at this point in the history
Adding GHA
  • Loading branch information
cpetersen authored Apr 23, 2024
2 parents 1fa3df9 + 2969d30 commit 29c8a1c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Ruby

on: pull_request

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']

steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Build and test with Rake
run: bundle exec rake
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
## Basic Usage

```ruby
use OmniAuth::Builder do
Rails.application.config.middleware.use OmniAuth::Builder do
provider :scientist, ENV['SCIENTIST_ID'], ENV['SCIENTIST_SECRET']
end
```

## Enterprise Usage

```ruby
provider :scientist, ENV['SCIENTIST_ID'], ENV['SCIENTIST_SECRET'],
{
client_options: {
site: 'https://<YOURSUBDOMAIN>.scientist.com',
authorize_url: 'https://<YOURSUBDOMAIN>.scientist.com/oauth/authorize',
token_url: 'https://<YOURSUBDOMAIN>.scientist.com/oauth/token'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :scientist, ENV['SCIENTIST_ID'], ENV['SCIENTIST_SECRET'],
{
client_options: {
site: 'https://<YOURSUBDOMAIN>.scientist.com',
authorize_url: 'https://<YOURSUBDOMAIN>.scientist.com/oauth/authorize',
token_url: 'https://<YOURSUBDOMAIN>.scientist.com/oauth/token'
}
}
}
end
```

## Credits

Heavily inspired by: [omniauth-github](https://github.com/omniauth/omniauth-github)

## License

Copyright (c) 2019 Assay Depot Inc. d/b/a Scientist.com
Copyright (c) 2024 Assay Depot Inc. d/b/a Scientist.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
15 changes: 0 additions & 15 deletions spec/omniauth/strategies/scientist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

describe OmniAuth::Strategies::Scientist do
let(:access_token) { instance_double('AccessToken', :options => {}, :[] => 'user') }
let(:parsed_response) { instance_double('ParsedResponse') }
let(:response) { instance_double('Response', :parsed => parsed_response) }

let(:enterprise_site) { 'https://some.other.site.com/api/v3' }
let(:enterprise_authorize_url) { 'https://some.other.site.com/login/oauth/authorize' }
Expand Down Expand Up @@ -63,19 +61,6 @@
end
end

context '#raw_info' do
it 'should use relative paths' do
expect(access_token).to receive(:get).with('user').and_return(response)
expect(subject.raw_info).to eq(parsed_response)
end

it 'should use the header auth mode' do
expect(access_token).to receive(:get).with('user').and_return(response)
subject.raw_info
expect(access_token.options[:mode]).to eq(:header)
end
end

context '#info.email' do
it 'should use any available email' do
allow(subject).to receive(:raw_info).and_return({})
Expand Down

0 comments on commit 29c8a1c

Please sign in to comment.