Skip to content

Commit

Permalink
Merge be39483 into 25d17b8
Browse files Browse the repository at this point in the history
  • Loading branch information
m1foley committed Jun 4, 2013
2 parents 25d17b8 + be39483 commit 42dd7db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ def inline(&block)
end

def inline_block
old_inline = inline?
self.inline = true
yield
ensure
self.inline = false
self.inline = old_inline
end

def inline?
Expand Down
10 changes: 10 additions & 0 deletions test/legacy/resque_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@
assert !Resque.inline?
end

it "inline block doesn't change inline to false if already inline" do
begin
Resque.inline = true
Resque.inline { }
assert Resque.inline?
ensure
Resque.inline = false
end
end

it "inline without block is alias to inline?" do
begin
assert_equal Resque.inline?, Resque.inline
Expand Down

0 comments on commit 42dd7db

Please sign in to comment.