Skip to content

Instantly share code, notes, and snippets.

@bhenderson
Last active December 29, 2015 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhenderson/7669316 to your computer and use it in GitHub Desktop.
Save bhenderson/7669316 to your computer and use it in GitHub Desktop.
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
index 5c27a99..64265f0 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -8,10 +8,10 @@ def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
self.class_eval <<-EOM
def #{new_name} *args
case
- when Proc === self then
- Minitest::Spec.current.#{meth}(*args, &self)
when #{!!dont_flip} then
Minitest::Spec.current.#{meth}(self, *args)
+ when Proc === self then
+ Minitest::Spec.current.#{meth}(*args, &self)
else
Minitest::Spec.current.#{meth}(args.first, self, *args[1..-1])
end
diff --git a/test/minitest/test_minitest_spec.rb b/test/minitest/test_minitest_spec.rb
index 3992f0e..b2cdb24 100755
--- a/test/minitest/test_minitest_spec.rb
+++ b/test/minitest/test_minitest_spec.rb
@@ -557,6 +557,12 @@ def _count
proc { let(:test_value) { true } }.must_raise ArgumentError
end
end
+
+ it 'procs come after dont_flip' do
+ p = proc{ }
+ assert_respond_to p, :call
+ p.must_respond_to :call
+ end
end
describe Minitest::Spec, :subject do
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment