Class: Stendhal::Mocks::TestDouble
- Defined in:
- lib/stendhal/mocks/test_double.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #assign_stubs(stubs) ⇒ Object
-
#initialize(name, stubs = {}) ⇒ TestDouble
constructor
A new instance of TestDouble.
Constructor Details
#initialize(name, stubs = {}) ⇒ TestDouble
Returns a new instance of TestDouble.
7 8 9 10 |
# File 'lib/stendhal/mocks/test_double.rb', line 7 def initialize(name, stubs = {}) @name = name assign_stubs(stubs) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/stendhal/mocks/test_double.rb', line 5 def name @name end |
Instance Method Details
#assign_stubs(stubs) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/stendhal/mocks/test_double.rb', line 12 def assign_stubs(stubs) stubs.each_pair do |k,v| (class << self;self;end).send(:define_method,k.to_sym) do |*args| v end end end |