test/lib/example_test.rb in contextr-0.1.9 vs test/lib/example_test.rb in contextr-1.0.0
- old
+ new
@@ -10,14 +10,14 @@
ExampleTest::latest_test_class = Class.new(Test::Unit::TestCase)
ExampleTest::latest_test_case = 0
Object.const_set(name, ExampleTest::latest_test_class)
end
- def example(&block)
+ def example(version = RUBY_VERSION, &block)
ExampleTest::latest_test_class.class_eval do
define_method("test_%03d" % (ExampleTest::latest_test_case += 1),
&block)
- end
+ end if RUBY_VERSION =~ Regexp.new(version.to_s)
end
end
module TestExtension
def assert_to_s(expected, actual)