Skip to content

Commit

Permalink
Update ci to use newest ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Goltergaul committed Feb 25, 2022
1 parent 2d5e18e commit f7f7ef5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 38 deletions.
23 changes: 12 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ orbs:
jobs:
test:
parameters:
image:
ruby_version:
type: string
docker:
- image: << parameters.image>>
- image: cimg/base:stable
steps:
- ruby/install:
version: << parameters.ruby_version >>
- checkout
- run: rm Gemfile.lock
- run: export GEM=$(which gem); sudo $GEM update --system --no-document
- run: gem install bundler
- run: bundle install
- ruby/rspec-test
linting:
docker:
- image: 'cimg/ruby:2.7'
- image: 'cimg/base:stable'
steps:
- checkout
- ruby/install:
version: "3.0"
- ruby/install-deps
- ruby/rubocop-check:
format: progress
Expand All @@ -42,11 +45,9 @@ workflows:
- test:
matrix:
parameters:
image:
- "cimg/ruby:2.6"
- "cimg/ruby:2.7"
- "cimg/ruby:3.0"
- "cimg/ruby:3.1"
- "circleci/jruby:9.3.3-jdk11"
- "circleci/jruby:9.2.20-jdk11"
ruby_version:
- "2.6"
- "2.7"
- "3.0"
- "jruby-9.3.3.0"
- linting
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 2.6

Metrics/LineLength:
Max: 119
Expand Down
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
definition (0.6.1)
definition (0.7.0)
activesupport
i18n

Expand Down Expand Up @@ -109,6 +109,7 @@ GEM
unicode-display_width (1.5.0)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
Expand Down
8 changes: 3 additions & 5 deletions lib/definition/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ def CoercibleType(klass) # rubocop:disable Style/MethodName
"a primitive that has a coercion function defined")
end
Types::Type.new(:type, klass) do |value|
begin
method(klass.name).call(value)
rescue ArgumentError
value
end
method(klass.name).call(value)
rescue ArgumentError
value
end
end

Expand Down
8 changes: 3 additions & 5 deletions spec/integration/lambda_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
describe "Definition.Lambda" do
subject(:definition) do
Definition.Lambda(:email) do |value|
begin
conform_with(value) if value =~ /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
rescue NoMethodError
value
end
conform_with(value) if value =~ /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
rescue NoMethodError
value
end
end

Expand Down
8 changes: 3 additions & 5 deletions spec/integration/value_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ class FooValueObject < Definition::ValueObject
end

it "correctly nests the error hash" do
begin
test_value_object.new(foo: { bar: 2.0 })
rescue Definition::InvalidValueObjectError => e
verify(format: :json) { e.conform_result.error_hash }
end
test_value_object.new(foo: { bar: 2.0 })
rescue Definition::InvalidValueObjectError => e
verify(format: :json) { e.conform_result.error_hash }
end
end
end
8 changes: 3 additions & 5 deletions spec/lib/definition/types/lambda_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@
describe "when definition does coerce" do
let(:test_lambda) do
lambda do |value|
begin
conform_with(Float(value))
rescue ArgumentError
value
end
conform_with(Float(value))
rescue ArgumentError
value
end
end

Expand Down
8 changes: 3 additions & 5 deletions spec/lib/definition/types/type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
context "with coercion lambda" do
let(:definition) do
described_class.new(:type, ::Integer) do |v|
begin
Integer(v)
rescue StandardError
v
end
Integer(v)
rescue StandardError
v
end
end

Expand Down

0 comments on commit f7f7ef5

Please sign in to comment.