Method: Assert::Macros::Methods::ClassMethods#_methods_macro_test

Defined in:
lib/assert/macros/methods.rb

#_methods_macro_testObject

private



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/assert/macros/methods.rb', line 102

def _methods_macro_test
  @_methods_macro_test ||= should "respond to methods" 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
        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
        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
        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
        assert_not_respond_to method, subject.class, msg
      end
    end

  end
end