Module Spec::Mocks::Methods
In: lib/spec/mocks/methods.rb

Methods

Public Instance methods

stub(sym_or_hash, opts={}, &block)

Alias for stub!

Supports stubbing a chain of methods. Each argument represents a method name to stub, and each one returns a proxy object that can accept more stubs, until the last, which returns whatever is passed to +and_return_.

Examples

  # with this in an example ...
  article = double('article')
  Article.stub_chain(:authored_by, :published, :recent).and_return([article])
  # then this will return an Array with the article double in it:
  Article.authored_by(params[:author_id]).published.recent
unstub(message)

Alias for unstub!

[Validate]