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

Improving the local development experience #397

Merged
merged 1 commit into from Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Expand Up @@ -31,6 +31,7 @@ jobs:
- 2.5
- 2.6
- 2.7
- 3.0
gemfile:
- gemfiles/standalone.gemfile
- gemfiles/openssl.gemfile
Expand Down
1 change: 1 addition & 0 deletions .rspec
@@ -1 +1,2 @@
--require spec_helper
--color
3 changes: 3 additions & 0 deletions .rubocop.yml
@@ -1,5 +1,8 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.1

Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation

Expand Down
2 changes: 1 addition & 1 deletion .ebert.yml → .sourcelevel.yml
Expand Up @@ -6,7 +6,7 @@ engines:
enabled: true
rubocop:
enabled: true
channel: rubocop-0-49
channel: rubocop-0-52
duplication:
config:
languages:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -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/)**
Expand Down
5 changes: 4 additions & 1 deletion 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
1 change: 1 addition & 0 deletions gemfiles/openssl.gemfile
Expand Up @@ -2,6 +2,7 @@

source "https://rubygems.org"

gem "rubocop", "~> 0.52.0"
gem "openssl", "~> 2.1"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rbnacl.gemfile
Expand Up @@ -2,6 +2,7 @@

source "https://rubygems.org"

gem "rubocop", "~> 0.52.0"
gem "rbnacl"

gemspec path: "../"
2 changes: 2 additions & 0 deletions gemfiles/standalone.gemfile
Expand Up @@ -2,4 +2,6 @@

source "https://rubygems.org"

gem "rubocop", "~> 0.52.0"

gemspec path: "../"
1 change: 0 additions & 1 deletion ruby-jwt.gemspec
Expand Up @@ -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
7 changes: 2 additions & 5 deletions 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' } }

Expand Down Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions 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) }
Expand Down
5 changes: 1 addition & 4 deletions 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
Expand Down
5 changes: 1 addition & 4 deletions 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
Expand Down
5 changes: 1 addition & 4 deletions 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
Expand Down
5 changes: 1 addition & 4 deletions 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 }

Expand Down
3 changes: 1 addition & 2 deletions 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) }
Expand Down