diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/minitest/mock.rb | 15 | ||||
-rw-r--r-- | lib/minitest/spec.rb | 8 | ||||
-rw-r--r-- | lib/minitest/unit.rb | 12 |
3 files changed, 10 insertions, 25 deletions
diff --git a/lib/minitest/mock.rb b/lib/minitest/mock.rb index ec36d775cc..38f15757eb 100644 --- a/lib/minitest/mock.rb +++ b/lib/minitest/mock.rb @@ -57,12 +57,12 @@ module MiniTest self end - def call name, data + def __call name, data case data when Hash then "#{name}(#{data[:args].inspect[1..-2]}) => #{data[:retval].inspect}" else - data.map { |d| call name, d }.join ", " + data.map { |d| __call name, d }.join ", " end end @@ -74,15 +74,16 @@ module MiniTest def verify @expected_calls.each do |name, calls| calls.each do |expected| - msg1 = "expected #{call name, expected}" - msg2 = "#{msg1}, got [#{call name, @actual_calls[name]}]" + msg1 = "expected #{__call name, expected}" + msg2 = "#{msg1}, got [#{__call name, @actual_calls[name]}]" raise MockExpectationError, msg2 if - @actual_calls.has_key? name and + @actual_calls.has_key?(name) and not @actual_calls[name].include?(expected) raise MockExpectationError, msg1 unless - @actual_calls.has_key? name and @actual_calls[name].include?(expected) + @actual_calls.has_key?(name) and + @actual_calls[name].include?(expected) end end true @@ -163,7 +164,7 @@ class Object # :nodoc: end end - yield + yield self ensure metaclass.send :undef_method, name metaclass.send :alias_method, name, new_name diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb index c0c0ae2f02..02c57ec7ef 100644 --- a/lib/minitest/spec.rb +++ b/lib/minitest/spec.rb @@ -181,12 +181,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase add_teardown_hook {|tc| tc.instance_eval(&block) } end - NAME_RE = if RUBY_VERSION >= "1.9" - Regexp.new("[^[[:word:]]]+") - else - /\W+/u - end - ## # Define an expectation with name +desc+. Name gets morphed to a # proper test method name. For some freakish reason, people who @@ -204,7 +198,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase @specs ||= 0 @specs += 1 - name = "test_%04d_%s" % [ @specs, desc.gsub(NAME_RE, '_').downcase ] + name = "test_%04d_%s" % [ @specs, desc ] define_method name, &block diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb index 50c1fac94b..1b95742af3 100644 --- a/lib/minitest/unit.rb +++ b/lib/minitest/unit.rb @@ -652,7 +652,7 @@ module MiniTest end class Unit # :nodoc: - VERSION = "3.0.0" # :nodoc: + VERSION = "3.2.0" # :nodoc: attr_accessor :report, :failures, :errors, :skips # :nodoc: attr_accessor :test_count, :assertion_count # :nodoc: @@ -714,16 +714,6 @@ module MiniTest end ## - # Returns the stream to use for output. - # - # DEPRECATED: use ::output instead. - - def self.out - warn "::out deprecated, use ::output instead." if $VERBOSE - output - end - - ## # Sets MiniTest::Unit to write output to +stream+. $stdout is the default # output |