Skip to content

Commit

Permalink
Fix standardrb issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gaffneyc committed Dec 19, 2024
1 parent 4def0e3 commit d366fdd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion interactor.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Gem::Specification.new do |spec|
spec.license = "MIT"

spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
spec.test_files = spec.files.grep(/^spec/)

spec.add_dependency "ostruct"
spec.add_development_dependency "bundler"
Expand Down
6 changes: 5 additions & 1 deletion lib/interactor/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ class Context < OpenStruct
#
# Returns the Interactor::Context.
def self.build(context = {})
self === context ? context : new(context)
if self === context
context
else
new(context)
end
end

# Public: Whether the Interactor::Context is successful. By default, a new
Expand Down
8 changes: 5 additions & 3 deletions spec/interactor/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ module Interactor
end

it "makes the context available from the failure" do
context.fail!
rescue Failure => error
expect(error.context).to eq(context)
begin
context.fail!
rescue Failure => error
expect(error.context).to eq(context)
end
end
end

Expand Down

0 comments on commit d366fdd

Please sign in to comment.