Skip to content

Commit

Permalink
Pass arguments from Interactor#fail! to Interactor::Context#fail!
Browse files Browse the repository at this point in the history
  • Loading branch information
laserlemon committed Jul 31, 2013
1 parent bb93b55 commit 8112f4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/interactor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def failure?
context.failure?
end

def fail!
context.fail!
def fail!(*args)
context.fail!(*args)
end

def method_missing(method, *)
Expand Down
8 changes: 7 additions & 1 deletion spec/interactor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,16 @@ def setup
let(:context) { instance.context }

it "defers to the context" do
expect(context).to receive(:fail!)
expect(context).to receive(:fail!).with(no_args)

instance.fail!
end

it "passes updates to the context" do
expect(context).to receive(:fail!).with(foo: "bar")

instance.fail!(foo: "bar")
end
end

describe "context deferral" do
Expand Down

0 comments on commit 8112f4c

Please sign in to comment.