lib/assert/macros/methods.rb in assert-2.16.3 vs lib/assert/macros/methods.rb in assert-2.16.4
- old
+ new
@@ -8,91 +8,91 @@
end
module ClassMethods
def have_instance_method(*methods)
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
Assert::Macro.new do
methods.each{ |m| _methods_macro_instance_methods << [m, called_from] }
_methods_macro_test called_from
end
end
alias_method :have_instance_methods, :have_instance_method
alias_method :have_imeth, :have_instance_method
alias_method :have_imeths, :have_instance_method
def not_have_instance_method(*methods)
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
Assert::Macro.new do
methods.each{ |m| _methods_macro_not_instance_methods << [m, called_from] }
_methods_macro_test called_from
end
end
alias_method :not_have_instance_methods, :not_have_instance_method
alias_method :not_have_imeth, :not_have_instance_method
alias_method :not_have_imeths, :not_have_instance_method
def have_class_method(*methods)
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
Assert::Macro.new do
methods.each{ |m| _methods_macro_class_methods << [m, called_from] }
_methods_macro_test called_from
end
end
alias_method :have_class_methods, :have_class_method
alias_method :have_cmeth, :have_class_method
alias_method :have_cmeths, :have_class_method
def not_have_class_method(*methods)
- called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
+ called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
Assert::Macro.new do
methods.each{ |m| _methods_macro_not_class_methods << [m, called_from] }
_methods_macro_test called_from
end
end
alias_method :not_have_class_methods, :not_have_class_method
alias_method :not_have_cmeth, :not_have_class_method
alias_method :not_have_cmeths, :not_have_class_method
def have_reader(*methods)
- methods << caller if !methods.last.kind_of?(Array)
+ methods << caller_locations if !methods.last.kind_of?(Array)
have_instance_methods(*methods)
end
alias_method :have_readers, :have_reader
def not_have_reader(*methods)
- methods << caller if !methods.last.kind_of?(Array)
+ methods << caller_locations if !methods.last.kind_of?(Array)
not_have_instance_methods(*methods)
end
alias_method :not_have_readers, :not_have_reader
def have_writer(*methods)
- called = methods.last.kind_of?(Array) ? methods.pop : caller
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
writer_meths = methods.collect{|m| "#{m}="}
writer_meths << called
have_instance_methods(*writer_meths)
end
alias_method :have_writers, :have_writer
def not_have_writer(*methods)
- called = methods.last.kind_of?(Array) ? methods.pop : caller
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
writer_meths = methods.collect{|m| "#{m}="}
writer_meths << called
not_have_instance_methods(*writer_meths)
end
alias_method :not_have_writers, :not_have_writer
def have_accessor(*methods)
- called = methods.last.kind_of?(Array) ? methods.pop : caller
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
accessor_meths = methods.collect{|m| [m, "#{m}="]}.flatten
accessor_meths << called
have_instance_methods(*accessor_meths)
end
alias_method :have_accessors, :have_accessor
def not_have_accessor(*methods)
- called = methods.last.kind_of?(Array) ? methods.pop : caller
+ called = methods.last.kind_of?(Array) ? methods.pop : caller_locations
accessor_meths = methods.collect{|m| [m, "#{m}="]}.flatten
accessor_meths << called
not_have_instance_methods(*accessor_meths)
end
alias_method :not_have_accessors, :not_have_accessor
@@ -102,31 +102,31 @@
def _methods_macro_test(called_from)
@_methods_macro_test ||= test "should respond to methods", called_from do
self.class._methods_macro_instance_methods.each do |(method, called_from)|
msg = "#{subject.class.name} does not have instance method ##{method}"
- with_backtrace(called_from) do
+ with_backtrace([called_from]) do
assert_respond_to method, subject, msg
end
end
self.class._methods_macro_class_methods.each do |(method, called_from)|
msg = "#{subject.class.name} does not have class method ##{method}"
- with_backtrace(called_from) do
+ with_backtrace([called_from]) do
assert_respond_to method, subject.class, msg
end
end
self.class._methods_macro_not_instance_methods.each do |(method, called_from)|
msg = "#{subject.class.name} has instance method ##{method}"
- with_backtrace(called_from) do
+ with_backtrace([called_from]) do
assert_not_respond_to method, subject, msg
end
end
self.class._methods_macro_not_class_methods.each do |(method, called_from)|
msg = "#{subject.class.name} has class method ##{method}"
- with_backtrace(called_from) do
+ with_backtrace([called_from]) do
assert_not_respond_to method, subject.class, msg
end
end
end