Skip to content

Commit

Permalink
forgot to update Rubocop to 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronLasseigne committed Jan 10, 2021
1 parent 0e85691 commit f7d0eec
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 2.5
Exclude:
- example/db/schema.rb
- tmp/**/*
Expand Down
8 changes: 3 additions & 5 deletions lib/active_interaction/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,9 @@ def populate_reader(key, value)

def populate_filters(inputs)
self.class.filters.each do |name, filter|
begin
public_send("#{name}=", filter.clean(inputs[name], self))
rescue InvalidValueError, MissingValueError, NoDefaultError
nil # #type_check will add errors if appropriate.
end
public_send("#{name}=", filter.clean(inputs[name], self))
rescue InvalidValueError, MissingValueError, NoDefaultError
nil # #type_check will add errors if appropriate.
end
end

Expand Down
15 changes: 7 additions & 8 deletions lib/active_interaction/modules/validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ class << self
# @param inputs [Hash{Symbol => Object}]
def validate(context, filters, inputs)
filters.each_with_object([]) do |(name, filter), errors|
begin
filter.clean(inputs[name], context)
rescue NoDefaultError
nil
rescue InvalidNestedValueError,
InvalidValueError, MissingValueError => e
errors << error_args(filter, e)
end
filter.clean(inputs[name], context)
rescue NoDefaultError
nil
rescue InvalidNestedValueError,
InvalidValueError,
MissingValueError => e
errors << error_args(filter, e)
end
end

Expand Down
10 changes: 4 additions & 6 deletions spec/active_interaction/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,10 @@ def execute
end

it 'has the correct backtrace' do
begin
described_class.run!(inputs)
rescue ActiveInteraction::InvalidInteractionError => e
expect(e.backtrace)
.to include(InterruptInteraction.composition_location)
end
described_class.run!(inputs)
rescue ActiveInteraction::InvalidInteractionError => e
expect(e.backtrace)
.to include(InterruptInteraction.composition_location)
end
end
end
Expand Down
10 changes: 4 additions & 6 deletions spec/active_interaction/filters/hash_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ def to_hash
end

it 'populates the error' do
begin
result
rescue ActiveInteraction::InvalidNestedValueError => e
expect(e.filter_name).to eql k
expect(e.input_value).to eql v
end
result
rescue ActiveInteraction::InvalidNestedValueError => e
expect(e.filter_name).to eql k
expect(e.input_value).to eql v
end
end
end
Expand Down

0 comments on commit f7d0eec

Please sign in to comment.