method

stub!

Importance_1
RSpec latest stable (1.2.8) - 2 notes - Class: Spec::Mocks::Methods
stub!(sym_or_hash, opts={}, &block) public

No documentation

This method has no description. You can help the RSpec community by adding new notes.

Show source
Register or log in to add new notes.
June 1, 2009
0 thanks

Typical stub! usage

Typically you would call

  my_object.stub!(:updated_at).and_return(time_object)
June 12, 2009
0 thanks

A stub with argument and return value

 it "should use a dummy method with argument and return value" do
  dummy = mock("dummy").stub!(:emulate)
  dummy.should_receive(:emulate).with(:something).and_return("Done! sir!")
  dummy.emulate(:something).should == "Done! sir!"
 end