Permalink
Browse files

Had to do some monkey patching for deepmerge

  • Loading branch information...
1 parent 374121c commit de5bbcbb17c6a6d3cd108ae1fcd6b6e921417104 @quirkey committed Mar 25, 2011
Showing with 24 additions and 6 deletions.
  1. +2 −2 .gitignore
  2. +20 −2 lib/minitest/display.rb
  3. +2 −2 test/helper.rb
View
@@ -40,5 +40,5 @@ pkg
#
# For vim:
#*.swp
-
-test/tmp
+tmp
+test/tmp
View
@@ -1,11 +1,29 @@
require 'benchmark'
+class Hash
+ unless method_defined?(:deep_merge!)
+
+ def deep_merge!(other_hash)
+ other_hash.each_pair do |k,v|
+ tv = self[k]
+ self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v
+ end
+ self
+ end
+
+ def deep_merge(other_hash)
+ dup.deep_merge!(other_hash)
+ end
+
+ end
+end
+
module MiniTest
module Display
class << self
def options
- @options || {
+ @options ||= {
suite_names: true,
suite_divider: " // ",
color: true,
@@ -29,7 +47,7 @@ def options
end
def options=(new_options)
- self.options.update(new_options)
+ self.options.deep_merge!(new_options)
end
def color(string, color)
View
@@ -19,9 +19,9 @@ class MiniTest::Unit::TestCase
def capture_test_output(testcase_str)
base_dir = File.expand_path(File.dirname(__FILE__))
lib_dir = File.expand_path(File.join(base_dir, '..', 'lib'))
- tmpdir = File.join(base_dir, "tmp")
+ tmpdir = File.join(base_dir, '..', "tmp")
FileUtils.mkdir_p(tmpdir)
- tmpfilename = "#{tmpdir}/test_suite.rb"
+ tmpfilename = "#{tmpdir}/fake_test_suite.rb"
header = %{
require 'minitest/autorun'
require '#{lib_dir}/minitest/display'

0 comments on commit de5bbcb

Please sign in to comment.