diff options
Diffstat (limited to 'lib/minitest/spec.rb')
-rw-r--r-- | lib/minitest/spec.rb | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb index 02c57ec7ef..1d85cd9f32 100644 --- a/lib/minitest/spec.rb +++ b/lib/minitest/spec.rb @@ -162,10 +162,11 @@ class MiniTest::Spec < MiniTest::Unit::TestCase # # Equivalent to MiniTest::Unit::TestCase#setup. - def self.before type = :each, &block - raise "unsupported before type: #{type}" unless type == :each - - add_setup_hook {|tc| tc.instance_eval(&block) } + def self.before type = nil, &block + define_method :setup do + super() + self.instance_eval(&block) + end end ## @@ -175,10 +176,11 @@ class MiniTest::Spec < MiniTest::Unit::TestCase # # Equivalent to MiniTest::Unit::TestCase#teardown. - def self.after type = :each, &block - raise "unsupported after type: #{type}" unless type == :each - - add_teardown_hook {|tc| tc.instance_eval(&block) } + def self.after type = nil, &block + define_method :teardown do + self.instance_eval(&block) + super() + end end ## @@ -247,14 +249,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase end # :stopdoc: - def after_setup - run_setup_hooks - end - - def before_teardown - run_teardown_hooks - end - class << self attr_reader :desc alias :specify :it @@ -290,11 +284,11 @@ module MiniTest::Expectations # # n.must_be_close_to m [, delta] # - # :method: must_be_within_delta + # :method: must_be_close_to infect_an_assertion :assert_in_delta, :must_be_close_to - alias :must_be_within_delta :must_be_close_to + alias :must_be_within_delta :must_be_close_to # :nodoc: ## # See MiniTest::Assertions#assert_in_epsilon @@ -450,12 +444,11 @@ module MiniTest::Expectations # # n.wont_be_close_to m [, delta] # - # :method: wont_be_within_delta + # :method: wont_be_close_to - infect_an_assertion :refute_in_delta, :wont_be_within_delta + infect_an_assertion :refute_in_delta, :wont_be_close_to - alias :wont_be_close_to :wont_be_within_delta - # FIX: reverse aliases + alias :wont_be_within_delta :wont_be_close_to # :nodoc: ## # See MiniTest::Assertions#refute_in_epsilon |