Skip to content

Commit

Permalink
Patch Test::Unit::Assertion#assert on Ruby 1.8 to return true on success
Browse files Browse the repository at this point in the history
Our Mocha `with do ... end` blocks fail otherwise.
  • Loading branch information
karmi committed Jun 25, 2012
1 parent ff00015 commit 5bb8aa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_helper.rb
Expand Up @@ -32,6 +32,11 @@

class Test::Unit::TestCase

def assert_block(message=nil)
raise Test::Unit::AssertionFailedError.new(message.to_s) if (! yield)
return true
end if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'

def mock_response(body, code=200, headers={})
Tire::HTTP::Response.new(body, code, headers)
end
Expand Down
6 changes: 6 additions & 0 deletions test/unit/rubyext_test.rb
Expand Up @@ -55,6 +55,12 @@ class RubyCoreExtensionsTest < Test::Unit::TestCase

end

context "Ruby Test::Unit" do
should "actually return true from assert..." do
assert_equal true, assert(true)
end
end

end

end

0 comments on commit 5bb8aa5

Please sign in to comment.