Skip to content

Commit

Permalink
Added unit tests that verify the correct fallback behaviour on 1.8.x. F…
Browse files Browse the repository at this point in the history
…ixes #18
  • Loading branch information
colszowka committed Jan 6, 2011
1 parent a7b582a commit 48cbb2e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/shoulda_macros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module ShouldaMacros
# The given strings will be regexp-matched against RUBY_VERSION
#
def on_ruby(*ruby_versions)
yield if ruby_versions.any? {|v| RUBY_VERSION =~ /#{v}/ }
context "On Ruby #{RUBY_VERSION}" do
yield
end if ruby_versions.any? {|v| RUBY_VERSION =~ /#{v}/ }
end
end
19 changes: 19 additions & 0 deletions test/test_1_8_fallbacks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'helper'

# Tests that verify that on 1.8 versions of ruby, simplecov simply
# does not launch and does not cause errors on the way
class Test18FallBacks < Test::Unit::TestCase
on_ruby '1.8' do
should "return false when calling SimpleCov.start" do
assert_equal false, SimpleCov.start
end

should "return false when calling SimpleCov.start with a block" do
assert_equal false, SimpleCov.start { raise "Shouldn't reach this!?" }
end

should "return false when calling SimpleCov.configure with a block" do
assert_equal false, SimpleCov.configure { raise "Shouldn't reach this!?" }
end
end
end

0 comments on commit 48cbb2e

Please sign in to comment.