Skip to content

Commit

Permalink
Merge pull request #18 from quixoten/fix_arg_passing
Browse files Browse the repository at this point in the history
Fix bug in argument passing
  • Loading branch information
ioquatix committed Aug 30, 2017
2 parents 2b61ee4 + b0ed038 commit 41c2d22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/async/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def yield
def run(*args)
if @status == :initialized
@status = :running
@fiber.resume(*args)
@fiber.resume(args)
else
raise RuntimeError, "Task already running!"
end
Expand Down
8 changes: 8 additions & 0 deletions spec/async/reactor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
expect(arg).to be == :arg
end.wait
end

it "passes in the correct number of arguments" do
reactor.async(:arg1, :arg2, :arg3) do |task, arg1, arg2, arg3|
expect(arg1).to be == :arg1
expect(arg2).to be == :arg2
expect(arg3).to be == :arg3
end.wait
end
end

describe '#to_s' do
Expand Down

0 comments on commit 41c2d22

Please sign in to comment.