From 5307a87d6f8d19dc017638687dd9b555ce297ee1 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Wed, 27 Sep 2023 16:18:49 +0300 Subject: [PATCH] Bump minimal ruby version to 2.7 and run tests in GitHub Actions --- .github/workflows/ruby.yml | 24 +++++++++++++++++++++++ .travis.yml | 7 ------- README.md | 5 +---- omniauth-swedbank.gemspec | 5 +++-- spec/omniauth/strategies/swedbank_spec.rb | 9 +++++---- 5 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/ruby.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..4a91e36 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,24 @@ +name: Ruby + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.7', '3.0', '3.1', '3.2'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rspec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2b663d5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: ruby -rvm: - - 2.2.6 - - 2.3.3 - - 2.4.1 - - 3.2.2 -script: bundle exec rspec diff --git a/README.md b/README.md index 8c836ba..a9024b1 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,7 @@ Omniauth strategy for using Swedbank as an authentication service provider. -[![Gem Version](https://badge.fury.io/rb/omniauth-swedbank.png)](http://badge.fury.io/rb/omniauth-swedbank) -[![Build Status](https://travis-ci.org/mitigate-dev/omniauth-swedbank.svg?branch=master)](https://travis-ci.org/mitigate-dev/omniauth-swedbank) - -Supported Ruby versions: 2.2+ +Supported Ruby versions: 2.7+ ## Related projects diff --git a/omniauth-swedbank.gemspec b/omniauth-swedbank.gemspec index ed2a7f5..b2379b5 100644 --- a/omniauth-swedbank.gemspec +++ b/omniauth-swedbank.gemspec @@ -18,14 +18,15 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.2.2' + spec.required_ruby_version = '>= 2.7' spec.add_runtime_dependency 'omniauth', '~> 2.1' spec.add_runtime_dependency 'i18n' - spec.add_development_dependency 'rack', '~> 2.0' + spec.add_development_dependency 'rack' spec.add_development_dependency 'rack-test' spec.add_development_dependency 'rspec' spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' + spec.add_development_dependency 'rack-session' end diff --git a/spec/omniauth/strategies/swedbank_spec.rb b/spec/omniauth/strategies/swedbank_spec.rb index 28d07b4..bcb4c8f 100644 --- a/spec/omniauth/strategies/swedbank_spec.rb +++ b/spec/omniauth/strategies/swedbank_spec.rb @@ -1,5 +1,6 @@ require 'spec_helper' require 'rack-protection' +require 'rack/session' describe OmniAuth::Strategies::Swedbank do @@ -7,7 +8,7 @@ PUBLIC_KEY = File.read(File.join(RSpec.configuration.cert_folder, 'response.public.pem')) let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY, PUBLIC_KEY, 'MY_SND_ID', 'MY_REC_ID') b.run lambda{|env| [404, {}, ['Not Found']]} end.to_app } @@ -81,7 +82,7 @@ context 'with custom options' do let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY, PUBLIC_KEY, 'MY_SND_ID', 'MY_REC_ID', site: 'https://test.lv/banklink') b.run lambda{|env| [404, {}, ['Not Found']]} @@ -94,7 +95,7 @@ context 'with non-existant private key files' do let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use(OmniAuth::Strategies::Swedbank, 'missing-private-key-file.pem', PUBLIC_KEY, 'MY_SND_ID', 'MY_REC_ID') b.run lambda{|env| [404, {}, ['Not Found']]} end.to_app } @@ -134,7 +135,7 @@ context 'with non-existant public key file' do let(:app){ Rack::Builder.new do |b| - b.use Rack::Session::Cookie, {secret: 'abc123'} + b.use Rack::Session::Cookie, {secret: '5242e6bd9daf0e9645c2d4e22b11ba8cee0bed44439906d5f1bd5dad409d8637'} b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY, 'missing-public-key-file.pem', 'MY_SND_ID', 'MY_REC_ID') b.run lambda{|env| [404, {}, ['Not Found']]} end.to_app }