File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,13 @@ module CoerceableTest
1111
1212 module ClassMethods
1313
14- def coerce_tests ( *methods )
14+ def coerce_tests! ( *methods )
1515 methods . each do |method |
1616 self . coerced_tests . push ( method )
1717 coerced_test_warning ( method )
1818 end
1919 end
2020
21- def coerce_test! ( method )
22- coerced_test_warning ( method )
23- end
24-
2521 def coerce_all_tests!
2622 once = false
2723 instance_methods ( false ) . each do |method |
@@ -32,14 +28,11 @@ def coerce_all_tests!
3228 STDOUT . puts "Info: Undefined all tests: #{ self . name } "
3329 end
3430
35- def method_added ( method )
36- coerced_test_warning ( method ) if coerced_tests . include? ( method . to_sym )
37- end
38-
3931 private
4032
4133 def coerced_test_warning ( method )
42- result = undef_method ( method ) rescue nil
34+ method = instance_methods ( false ) . detect { |m | m =~ method } if method . is_a? ( Regexp )
35+ result = undef_method ( method ) if method && method_defined? ( method )
4336 STDOUT . puts "Info: Undefined coerced test: #{ self . name } ##{ method } " unless result . blank?
4437 end
4538
You can’t perform that action at this time.
0 commit comments