Skip to content

Commit

Permalink
Configure github actions and fix autocorrectable rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
waiting-for-dev committed Dec 15, 2024
1 parent acb6aa1 commit 787164d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on: [push, pull_request]

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

steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # 'bundle install' and cache
- name: Run specs
run: |
bundle exec rspec
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true # 'bundle install' and cache
- name: Run specs
run: |
bundle exec rubocop
10 changes: 5 additions & 5 deletions spec/warden/jwt_auth/strategy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
end
end

context "when issuer is configured" do
let(:token) { Warden::JWTAuth::TokenEncoder.new.call({issuer: issuer}) }
context 'when issuer is configured' do
let(:token) { Warden::JWTAuth::TokenEncoder.new.call({ issuer: issuer }) }
let(:env) { { 'HTTP_AUTHORIZATION' => "Bearer #{token}" } }
let(:issuer) { 'http://example.com' }
let(:strategy) { described_class.new(env, :user) }
Expand All @@ -43,14 +43,14 @@
end
end

context "when the issuer claim matches the configured issuer" do
context 'when the issuer claim matches the configured issuer' do
it 'returns true' do
expect(strategy).to be_valid
end
end

context "when the issuer claim does not match the configured issuer" do
let(:token) { Warden::JWTAuth::TokenEncoder.new.call({"iss" => 'http://example.org'}) }
context 'when the issuer claim does not match the configured issuer' do
let(:token) { Warden::JWTAuth::TokenEncoder.new.call({ 'iss' => 'http://example.org' }) }

it 'returns false' do
expect(strategy).not_to be_valid
Expand Down
1 change: 1 addition & 0 deletions spec/warden/jwt_auth/token_encoder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

context 'with issuer claim' do
let(:issuer) { 'http://example.com' }

before do
Warden::JWTAuth.configure do |config|
config.issuer = issuer
Expand Down

0 comments on commit 787164d

Please sign in to comment.