Module: RR::StubCreator::InstanceMethods

Defined in:
lib/rr/stub_creator.rb

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &returns) ⇒ Object (protected)



18
19
20
21
22
23
24
25
26
27
# File 'lib/rr/stub_creator.rb', line 18

def method_missing(method_name, *args, &returns)
  double = @space.create_double(@subject, method_name)
  scenario = @space.create_scenario(double)
  scenario.returns(&returns).any_number_of_times
  if args.empty?
    scenario.with_any_args
  else
    scenario.with(*args)
  end
end