Class: JayUnit::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/jay_unit.rb

Overview

end start

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



150
151
152
# File 'lib/jay_unit.rb', line 150

def method_missing(sym,*args,&block)
  @_msgs << ['Instance',sym,args,block]
end

Class Method Details

.method_missing(sym, *args, &block) ⇒ Object



147
148
149
# File 'lib/jay_unit.rb', line 147

def self.method_missing(sym,*args,&block)
  @_msgs << ['Singleton',sym,args,block]
end

Instance Method Details

#arg?(value) ⇒ Boolean

Returns:

  • (Boolean)


159
160
161
162
163
164
# File 'lib/jay_unit.rb', line 159

def arg? value
  @_msgs.each do |m|
    return true if m[2].class == Array and m[2].include?(value)
  end
  return false
end

#received?(sym) ⇒ Boolean

Returns:

  • (Boolean)


153
154
155
156
157
158
# File 'lib/jay_unit.rb', line 153

def received? sym
  @_msgs.each do |m|
    return true if m[1] == sym
  end
  return false
end