Concept "Method stubs"

From SMW CindyKate - Main
Component 321538
Jump to: navigation, search

Content


= method-level applied to object-level concepts

my_double.stub(:some_method).and_return("something") # this is a.fluent.interface
my_double = double("", :some_method => 'something')

Using argument "what"

my_double.stub(:some_method) do |what|
  if what == 0
end

Stub-chaining

my_double.stub_chain(:some_method0, :some_method1).and_return("something"
==> my_double.some_method0.some_method1()