diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52c1e0b0..5391ffac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,7 @@ jobs: - 2.5 - 2.6 - 2.7 + - 3.0 gemfile: - gemfiles/standalone.gemfile - gemfiles/openssl.gemfile diff --git a/.rspec b/.rspec index 4e1e0d2f..3687797e 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ +--require spec_helper --color diff --git a/.rubocop.yml b/.rubocop.yml index dbd8a04b..09abda53 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,8 @@ inherit_from: .rubocop_todo.yml +AllCops: + TargetRubyVersion: 2.1 + Layout/AlignParameters: EnforcedStyle: with_fixed_indentation diff --git a/.ebert.yml b/.sourcelevel.yml similarity index 90% rename from .ebert.yml rename to .sourcelevel.yml index 25e7a344..b3315650 100644 --- a/.ebert.yml +++ b/.sourcelevel.yml @@ -6,7 +6,7 @@ engines: enabled: true rubocop: enabled: true - channel: rubocop-0-49 + channel: rubocop-0-52 duplication: config: languages: diff --git a/README.md b/README.md index 9850b9fc..510df1d2 100644 --- a/README.md +++ b/README.md @@ -525,10 +525,11 @@ We depend on [Bundler](http://rubygems.org/gems/bundler) for defining gemspec an rake release ``` -The tests are written with rspec. Given you have installed the dependencies via bundler, you can run tests with +The tests are written with rspec. [Appraisal](https://github.com/thoughtbot/appraisal) is used to ensure compatibility with 3rd party dependencies providing cryptographic features. ```bash -bundle exec rspec +bundle install +bundle exec appraisal rake test ``` **If you want a release cut with your PR, please include a version bump according to [Semantic Versioning](http://semver.org/)** diff --git a/Rakefile b/Rakefile index 727c38a9..d641df1c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,11 +1,14 @@ +require 'bundler/setup' require 'bundler/gem_tasks' begin require 'rspec/core/rake_task' + require 'rubocop/rake_task' RSpec::Core::RakeTask.new(:test) + RuboCop::RakeTask.new(:rubocop) - task default: :test + task default: %i[rubocop test] rescue LoadError puts 'RSpec rake tasks not available. Please run "bundle install" to install missing dependencies.' end diff --git a/gemfiles/openssl.gemfile b/gemfiles/openssl.gemfile index 94ce8660..7b269727 100644 --- a/gemfiles/openssl.gemfile +++ b/gemfiles/openssl.gemfile @@ -2,6 +2,7 @@ source "https://rubygems.org" +gem "rubocop", "~> 0.52.0" gem "openssl", "~> 2.1" gemspec path: "../" diff --git a/gemfiles/rbnacl.gemfile b/gemfiles/rbnacl.gemfile index ad523a89..c1f3d686 100644 --- a/gemfiles/rbnacl.gemfile +++ b/gemfiles/rbnacl.gemfile @@ -2,6 +2,7 @@ source "https://rubygems.org" +gem "rubocop", "~> 0.52.0" gem "rbnacl" gemspec path: "../" diff --git a/gemfiles/standalone.gemfile b/gemfiles/standalone.gemfile index 095e6608..02bc57bd 100644 --- a/gemfiles/standalone.gemfile +++ b/gemfiles/standalone.gemfile @@ -2,4 +2,6 @@ source "https://rubygems.org" +gem "rubocop", "~> 0.52.0" + gemspec path: "../" diff --git a/ruby-jwt.gemspec b/ruby-jwt.gemspec index a0415b7d..946e8e77 100644 --- a/ruby-jwt.gemspec +++ b/ruby-jwt.gemspec @@ -27,5 +27,4 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'simplecov', '< 0.18' spec.add_development_dependency 'simplecov-json' spec.add_development_dependency 'codeclimate-test-reporter' - spec.add_development_dependency 'codacy-coverage' end diff --git a/spec/integration/readme_examples_spec.rb b/spec/integration/readme_examples_spec.rb index 7488541c..7b50a0d8 100644 --- a/spec/integration/readme_examples_spec.rb +++ b/spec/integration/readme_examples_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -require_relative '../spec_helper' -require 'jwt' - -describe 'README.md code test' do +RSpec.describe 'README.md code test' do context 'algorithm usage' do let(:payload) { { data: 'test' } } @@ -79,7 +76,7 @@ { 'data' => 'test' }, { 'alg' => 'PS256' } ] - end if OpenSSL::VERSION >= '2.1' + end if ::Gem::Version.new(OpenSSL::VERSION) >= ::Gem::Version.new('2.1') end context 'claims' do diff --git a/spec/jwk/decode_with_jwk_spec.rb b/spec/jwk/decode_with_jwk_spec.rb index c16e85b2..3e8ccfe4 100644 --- a/spec/jwk/decode_with_jwk_spec.rb +++ b/spec/jwk/decode_with_jwk_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -require_relative '../spec_helper' -require 'jwt' - -describe JWT do +RSpec.describe JWT do describe '.decode for JWK usecase' do let(:keypair) { OpenSSL::PKey::RSA.new(2048) } let(:jwk) { JWT::JWK.new(keypair) } diff --git a/spec/jwk/ec_spec.rb b/spec/jwk/ec_spec.rb index 08050880..3a949766 100644 --- a/spec/jwk/ec_spec.rb +++ b/spec/jwk/ec_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -require_relative '../spec_helper' -require 'jwt' - -describe JWT::JWK::EC do +RSpec.describe JWT::JWK::EC do let(:ec_key) { OpenSSL::PKey::EC.new("secp384r1").generate_key } describe '.new' do diff --git a/spec/jwk/hmac_spec.rb b/spec/jwk/hmac_spec.rb index 31ad4ee0..d7594077 100644 --- a/spec/jwk/hmac_spec.rb +++ b/spec/jwk/hmac_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -require_relative '../spec_helper' -require 'jwt' - -describe JWT::JWK::HMAC do +RSpec.describe JWT::JWK::HMAC do let(:hmac_key) { 'secret-key' } describe '.new' do diff --git a/spec/jwk/rsa_spec.rb b/spec/jwk/rsa_spec.rb index 4b6c9274..d5cc37e8 100644 --- a/spec/jwk/rsa_spec.rb +++ b/spec/jwk/rsa_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -require_relative '../spec_helper' -require 'jwt' - -describe JWT::JWK::RSA do +RSpec.describe JWT::JWK::RSA do let(:rsa_key) { OpenSSL::PKey::RSA.new(2048) } describe '.new' do diff --git a/spec/jwk_spec.rb b/spec/jwk_spec.rb index 277eedfa..1fc606f0 100644 --- a/spec/jwk_spec.rb +++ b/spec/jwk_spec.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' -require 'jwt' - -describe JWT::JWK do +RSpec.describe JWT::JWK do let(:rsa_key) { OpenSSL::PKey::RSA.new(2048) } let(:ec_key) { OpenSSL::PKey::EC.new("secp384r1").generate_key } diff --git a/spec/jwt/claims_validator_spec.rb b/spec/jwt/claims_validator_spec.rb index 06d707a1..e2908879 100644 --- a/spec/jwt/claims_validator_spec.rb +++ b/spec/jwt/claims_validator_spec.rb @@ -1,5 +1,4 @@ -require 'spec_helper' -require 'jwt/claims_validator' +# frozen_string_literal: true RSpec.describe JWT::ClaimsValidator do let(:validator) { described_class.new(claims) } diff --git a/spec/jwt/verify_spec.rb b/spec/jwt/verify_spec.rb index a434a171..3cb763ac 100644 --- a/spec/jwt/verify_spec.rb +++ b/spec/jwt/verify_spec.rb @@ -1,229 +1,224 @@ # frozen_string_literal: true -require 'spec_helper' -require 'jwt/verify' - -module JWT # rubocop:disable Metrics/ModuleLength - RSpec.describe Verify do - let(:base_payload) { { 'user_id' => 'some@user.tld' } } - let(:options) { { leeway: 0 } } +RSpec.describe ::JWT::Verify do + let(:base_payload) { { 'user_id' => 'some@user.tld' } } + let(:options) { { leeway: 0 } } + + context '.verify_aud(payload, options)' do + let(:scalar_aud) { 'ruby-jwt-aud' } + let(:array_aud) { %w[ruby-jwt-aud test-aud ruby-ruby-ruby] } + let(:scalar_payload) { base_payload.merge('aud' => scalar_aud) } + let(:array_payload) { base_payload.merge('aud' => array_aud) } + + it 'must raise JWT::InvalidAudError when the singular audience does not match' do + expect do + described_class.verify_aud(scalar_payload, options.merge(aud: 'no-match')) + end.to raise_error JWT::InvalidAudError + end - context '.verify_aud(payload, options)' do - let(:scalar_aud) { 'ruby-jwt-aud' } - let(:array_aud) { %w[ruby-jwt-aud test-aud ruby-ruby-ruby] } - let(:scalar_payload) { base_payload.merge('aud' => scalar_aud) } - let(:array_payload) { base_payload.merge('aud' => array_aud) } + it 'must raise JWT::InvalidAudError when the payload has an array and none match the supplied value' do + expect do + described_class.verify_aud(array_payload, options.merge(aud: 'no-match')) + end.to raise_error JWT::InvalidAudError + end - it 'must raise JWT::InvalidAudError when the singular audience does not match' do - expect do - Verify.verify_aud(scalar_payload, options.merge(aud: 'no-match')) - end.to raise_error JWT::InvalidAudError - end + it 'must allow a matching singular audience to pass' do + described_class.verify_aud(scalar_payload, options.merge(aud: scalar_aud)) + end - it 'must raise JWT::InvalidAudError when the payload has an array and none match the supplied value' do - expect do - Verify.verify_aud(array_payload, options.merge(aud: 'no-match')) - end.to raise_error JWT::InvalidAudError - end + it 'must allow an array with any value matching the one in the options' do + described_class.verify_aud(array_payload, options.merge(aud: array_aud.first)) + end - it 'must allow a matching singular audience to pass' do - Verify.verify_aud(scalar_payload, options.merge(aud: scalar_aud)) - end + it 'must allow an array with any value matching any value in the options array' do + described_class.verify_aud(array_payload, options.merge(aud: array_aud)) + end - it 'must allow an array with any value matching the one in the options' do - Verify.verify_aud(array_payload, options.merge(aud: array_aud.first)) - end + it 'must allow a singular audience payload matching any value in the options array' do + described_class.verify_aud(scalar_payload, options.merge(aud: array_aud)) + end + end - it 'must allow an array with any value matching any value in the options array' do - Verify.verify_aud(array_payload, options.merge(aud: array_aud)) - end + context '.verify_expiration(payload, options)' do + let(:payload) { base_payload.merge('exp' => (Time.now.to_i - 5)) } - it 'must allow a singular audience payload matching any value in the options array' do - Verify.verify_aud(scalar_payload, options.merge(aud: array_aud)) - end + it 'must raise JWT::ExpiredSignature when the token has expired' do + expect do + described_class.verify_expiration(payload, options) + end.to raise_error JWT::ExpiredSignature end - context '.verify_expiration(payload, options)' do - let(:payload) { base_payload.merge('exp' => (Time.now.to_i - 5)) } + it 'must allow some leeway in the expiration when global leeway is configured' do + described_class.verify_expiration(payload, options.merge(leeway: 10)) + end - it 'must raise JWT::ExpiredSignature when the token has expired' do - expect do - Verify.verify_expiration(payload, options) - end.to raise_error JWT::ExpiredSignature - end + it 'must allow some leeway in the expiration when exp_leeway is configured' do + described_class.verify_expiration(payload, options.merge(exp_leeway: 10)) + end - it 'must allow some leeway in the expiration when global leeway is configured' do - Verify.verify_expiration(payload, options.merge(leeway: 10)) - end + it 'must be expired if the exp claim equals the current time' do + payload['exp'] = Time.now.to_i - it 'must allow some leeway in the expiration when exp_leeway is configured' do - Verify.verify_expiration(payload, options.merge(exp_leeway: 10)) - end + expect do + described_class.verify_expiration(payload, options) + end.to raise_error JWT::ExpiredSignature + end - it 'must be expired if the exp claim equals the current time' do - payload['exp'] = Time.now.to_i + context 'when leeway is not specified' do + let(:options) { {} } + it 'used a default leeway of 0' do expect do - Verify.verify_expiration(payload, options) + described_class.verify_expiration(payload, options) end.to raise_error JWT::ExpiredSignature end + end + end - context 'when leeway is not specified' do - let(:options) { {} } + context '.verify_iat(payload, options)' do + let(:iat) { Time.now.to_f } + let(:payload) { base_payload.merge('iat' => iat) } - it 'used a default leeway of 0' do - expect do - Verify.verify_expiration(payload, options) - end.to raise_error JWT::ExpiredSignature - end - end + it 'must allow a valid iat' do + described_class.verify_iat(payload, options) end - context '.verify_iat(payload, options)' do - let(:iat) { Time.now.to_f } - let(:payload) { base_payload.merge('iat' => iat) } + it 'must ignore configured leeway' do + expect{described_class.verify_iat(payload.merge('iat' => (iat + 60)), options.merge(leeway: 70)) } + .to raise_error(JWT::InvalidIatError) + end - it 'must allow a valid iat' do - Verify.verify_iat(payload, options) - end + it 'must properly handle integer times' do + described_class.verify_iat(payload.merge('iat' => Time.now.to_i), options) + end - it 'must ignore configured leeway' do - expect{Verify.verify_iat(payload.merge('iat' => (iat + 60)), options.merge(leeway: 70)) } - .to raise_error(JWT::InvalidIatError) - end + it 'must raise JWT::InvalidIatError when the iat value is not Numeric' do + expect do + described_class.verify_iat(payload.merge('iat' => 'not a number'), options) + end.to raise_error JWT::InvalidIatError + end - it 'must properly handle integer times' do - Verify.verify_iat(payload.merge('iat' => Time.now.to_i), options) - end + it 'must raise JWT::InvalidIatError when the iat value is in the future' do + expect do + described_class.verify_iat(payload.merge('iat' => (iat + 120)), options) + end.to raise_error JWT::InvalidIatError + end + end - it 'must raise JWT::InvalidIatError when the iat value is not Numeric' do + context '.verify_iss(payload, options)' do + let(:iss) { 'ruby-jwt-gem' } + let(:payload) { base_payload.merge('iss' => iss) } + + let(:invalid_token) { JWT.encode base_payload, payload[:secret] } + + context 'when iss is a String' do + it 'must raise JWT::InvalidIssuerError when the configured issuer does not match the payload issuer' do expect do - Verify.verify_iat(payload.merge('iat' => 'not a number'), options) - end.to raise_error JWT::InvalidIatError + described_class.verify_iss(payload, options.merge(iss: 'mismatched-issuer')) + end.to raise_error JWT::InvalidIssuerError end - it 'must raise JWT::InvalidIatError when the iat value is in the future' do + it 'must raise JWT::InvalidIssuerError when the payload does not include an issuer' do expect do - Verify.verify_iat(payload.merge('iat' => (iat + 120)), options) - end.to raise_error JWT::InvalidIatError + described_class.verify_iss(base_payload, options.merge(iss: iss)) + end.to raise_error(JWT::InvalidIssuerError, /received /) end - end - - context '.verify_iss(payload, options)' do - let(:iss) { 'ruby-jwt-gem' } - let(:payload) { base_payload.merge('iss' => iss) } - - let(:invalid_token) { JWT.encode base_payload, payload[:secret] } - - context 'when iss is a String' do - it 'must raise JWT::InvalidIssuerError when the configured issuer does not match the payload issuer' do - expect do - Verify.verify_iss(payload, options.merge(iss: 'mismatched-issuer')) - end.to raise_error JWT::InvalidIssuerError - end - it 'must raise JWT::InvalidIssuerError when the payload does not include an issuer' do - expect do - Verify.verify_iss(base_payload, options.merge(iss: iss)) - end.to raise_error(JWT::InvalidIssuerError, /received /) - end - - it 'must allow a matching issuer to pass' do - Verify.verify_iss(payload, options.merge(iss: iss)) - end + it 'must allow a matching issuer to pass' do + described_class.verify_iss(payload, options.merge(iss: iss)) + end + end + context 'when iss is an Array' do + it 'must raise JWT::InvalidIssuerError when no matching issuers in array' do + expect do + described_class.verify_iss(payload, options.merge(iss: %w[first second])) + end.to raise_error JWT::InvalidIssuerError end - context 'when iss is an Array' do - it 'must raise JWT::InvalidIssuerError when no matching issuers in array' do - expect do - Verify.verify_iss(payload, options.merge(iss: %w[first second])) - end.to raise_error JWT::InvalidIssuerError - end - it 'must raise JWT::InvalidIssuerError when the payload does not include an issuer' do - expect do - Verify.verify_iss(base_payload, options.merge(iss: %w[first second])) - end.to raise_error(JWT::InvalidIssuerError, /received /) - end + it 'must raise JWT::InvalidIssuerError when the payload does not include an issuer' do + expect do + described_class.verify_iss(base_payload, options.merge(iss: %w[first second])) + end.to raise_error(JWT::InvalidIssuerError, /received /) + end - it 'must allow an array with matching issuer to pass' do - Verify.verify_iss(payload, options.merge(iss: ['first', iss, 'third'])) - end + it 'must allow an array with matching issuer to pass' do + described_class.verify_iss(payload, options.merge(iss: ['first', iss, 'third'])) end end + end - context '.verify_jti(payload, options)' do - let(:payload) { base_payload.merge('jti' => 'some-random-uuid-or-whatever') } + context '.verify_jti(payload, options)' do + let(:payload) { base_payload.merge('jti' => 'some-random-uuid-or-whatever') } - it 'must allow any jti when the verfy_jti key in the options is truthy but not a proc' do - Verify.verify_jti(payload, options.merge(verify_jti: true)) - end + it 'must allow any jti when the verfy_jti key in the options is truthy but not a proc' do + described_class.verify_jti(payload, options.merge(verify_jti: true)) + end - it 'must raise JWT::InvalidJtiError when the jti is missing' do - expect do - Verify.verify_jti(base_payload, options) - end.to raise_error JWT::InvalidJtiError, /missing/i - end + it 'must raise JWT::InvalidJtiError when the jti is missing' do + expect do + described_class.verify_jti(base_payload, options) + end.to raise_error JWT::InvalidJtiError, /missing/i + end - it 'must raise JWT::InvalidJtiError when the jti is an empty string' do - expect do - Verify.verify_jti(base_payload.merge('jti' => ' '), options) - end.to raise_error JWT::InvalidJtiError, /missing/i - end + it 'must raise JWT::InvalidJtiError when the jti is an empty string' do + expect do + described_class.verify_jti(base_payload.merge('jti' => ' '), options) + end.to raise_error JWT::InvalidJtiError, /missing/i + end - it 'must raise JWT::InvalidJtiError when verify_jti proc returns false' do - expect do - Verify.verify_jti(payload, options.merge(verify_jti: ->(_jti) { false })) - end.to raise_error JWT::InvalidJtiError, /invalid/i - end + it 'must raise JWT::InvalidJtiError when verify_jti proc returns false' do + expect do + described_class.verify_jti(payload, options.merge(verify_jti: ->(_jti) { false })) + end.to raise_error JWT::InvalidJtiError, /invalid/i + end - it 'true proc should not raise JWT::InvalidJtiError' do - Verify.verify_jti(payload, options.merge(verify_jti: ->(_jti) { true })) - end + it 'true proc should not raise JWT::InvalidJtiError' do + described_class.verify_jti(payload, options.merge(verify_jti: ->(_jti) { true })) + end - it 'it should not throw arguement error with 2 args' do - expect do - Verify.verify_jti(payload, options.merge(verify_jti: ->(_jti, pl) { - true - })) - end.to_not raise_error - end - it 'should have payload as second param in proc' do - Verify.verify_jti(payload, options.merge(verify_jti: ->(_jti, pl) { - expect(pl).to eq(payload) + it 'it should not throw arguement error with 2 args' do + expect do + described_class.verify_jti(payload, options.merge(verify_jti: ->(_jti, pl) { + true })) - end + end.to_not raise_error end + it 'should have payload as second param in proc' do + described_class.verify_jti(payload, options.merge(verify_jti: ->(_jti, pl) { + expect(pl).to eq(payload) + })) + end + end - context '.verify_not_before(payload, options)' do - let(:payload) { base_payload.merge('nbf' => (Time.now.to_i + 5)) } + context '.verify_not_before(payload, options)' do + let(:payload) { base_payload.merge('nbf' => (Time.now.to_i + 5)) } - it 'must raise JWT::ImmatureSignature when the nbf in the payload is in the future' do - expect do - Verify.verify_not_before(payload, options) - end.to raise_error JWT::ImmatureSignature - end + it 'must raise JWT::ImmatureSignature when the nbf in the payload is in the future' do + expect do + described_class.verify_not_before(payload, options) + end.to raise_error JWT::ImmatureSignature + end - it 'must allow some leeway in the token age when global leeway is configured' do - Verify.verify_not_before(payload, options.merge(leeway: 10)) - end + it 'must allow some leeway in the token age when global leeway is configured' do + described_class.verify_not_before(payload, options.merge(leeway: 10)) + end - it 'must allow some leeway in the token age when nbf_leeway is configured' do - Verify.verify_not_before(payload, options.merge(nbf_leeway: 10)) - end + it 'must allow some leeway in the token age when nbf_leeway is configured' do + described_class.verify_not_before(payload, options.merge(nbf_leeway: 10)) end + end - context '.verify_sub(payload, options)' do - let(:sub) { 'ruby jwt subject' } + context '.verify_sub(payload, options)' do + let(:sub) { 'ruby jwt subject' } - it 'must raise JWT::InvalidSubError when the subjects do not match' do - expect do - Verify.verify_sub(base_payload.merge('sub' => 'not-a-match'), options.merge(sub: sub)) - end.to raise_error JWT::InvalidSubError - end + it 'must raise JWT::InvalidSubError when the subjects do not match' do + expect do + described_class.verify_sub(base_payload.merge('sub' => 'not-a-match'), options.merge(sub: sub)) + end.to raise_error JWT::InvalidSubError + end - it 'must allow a matching sub' do - Verify.verify_sub(base_payload.merge('sub' => sub), options.merge(sub: sub)) - end + it 'must allow a matching sub' do + described_class.verify_sub(base_payload.merge('sub' => sub), options.merge(sub: sub)) end context '.verify_claims' do @@ -242,12 +237,12 @@ module JWT # rubocop:disable Metrics/ModuleLength %w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub].each do |method| let(:payload) { base_payload.merge(fail_verifications_payload) } it "must skip verification when #{method} option is set to false" do - Verify.verify_claims(payload, options.merge(method => false)) + described_class.verify_claims(payload, options.merge(method => false)) end it "must raise error when #{method} option is set to true" do expect do - Verify.verify_claims(payload, options.merge(method => true).merge(fail_verifications_options)) + described_class.verify_claims(payload, options.merge(method => true).merge(fail_verifications_options)) end.to raise_error end end diff --git a/spec/jwt_spec.rb b/spec/jwt_spec.rb index a5e5f3d6..fbf86a94 100644 --- a/spec/jwt_spec.rb +++ b/spec/jwt_spec.rb @@ -1,9 +1,6 @@ -require 'spec_helper' -require 'jwt' -require 'jwt/encode' -require 'jwt/decode' +# frozen_string_literal: true -describe JWT do +RSpec.describe JWT do let(:payload) { { 'user_id' => 'some@user.tld' } } let :data do @@ -263,7 +260,7 @@ end end - unless OpenSSL::VERSION >= '2.1' + unless ::Gem::Version.new(OpenSSL::VERSION) >= ::Gem::Version.new('2.1') %w[PS256 PS384 PS512].each do |alg| context "alg: #{alg}" do it 'raises error about OpenSSL version' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a6ecae86..c16ebf54 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,28 +1,26 @@ +# frozen_string_literal: true + require 'rspec' require 'simplecov' require 'simplecov-json' require 'codeclimate-test-reporter' -require 'codacy-coverage' - -Codacy::Reporter.start -SimpleCov.configure do +SimpleCov.start do root File.join(File.dirname(__FILE__), '..') project_name 'Ruby JWT - Ruby JSON Web Token implementation' add_filter 'spec' end -SimpleCov.start if ENV['COVERAGE'] +require 'jwt' CERT_PATH = File.join(File.dirname(__FILE__), 'fixtures', 'certs') RSpec.configure do |config| config.expect_with :rspec do |c| - c.syntax = %i[should expect] + c.syntax = :expect end config.run_all_when_everything_filtered = true config.filter_run :focus - config.order = 'random' end