Top Level Namespace
- Extended by:
- RSpec::Mocks::ExampleMethods
Defined Under Namespace
Modules: RSpec Classes: BasicObject, Class
Instance Method Summary collapse
- 
  
      #as_null_object  ⇒ Object 
  
    Tells the object to respond to all messages. 
- 
  
      #null_object?  ⇒ Object 
  
    Returns true if this object has received as_null_object.
- 
  
      #should_not_receive  ⇒ Object 
  
    Sets and expectation that this object should not receive a message during this example. 
- 
  
      #should_receive  ⇒ Object 
  
    Sets an expectation that this object should receive a message before the end of the example. 
- 
  
      #stub  ⇒ Object 
  
    Tells the object to respond to the message with the specified value. 
- 
  
      #stub_chain  ⇒ Object 
  
    Stubs a chain of methods. 
- 
  
      #unstub  ⇒ Object 
  
    Removes a stub. 
Methods included from RSpec::Mocks::ExampleMethods
allow, allow_any_instance_of, allow_message_expectations_on_nil, class_double, class_spy, double, expect, expect_any_instance_of, have_received, hide_const, instance_double, instance_spy, object_double, object_spy, receive, receive_message_chain, receive_messages, spy, stub_const, without_partial_double_verification
Methods included from RSpec::Mocks::ArgumentMatchers
#any_args, #anything, #array_including, #boolean, #duck_type, #hash_excluding, #hash_including, #instance_of, #kind_of, #no_args
Instance Method Details
#as_null_object ⇒ Object
This is only available when you have enabled the should syntax.
Tells the object to respond to all messages. If specific stub values are declared, they'll work as expected. If not, the receiver is returned.
|  | # File 'lib/rspec/mocks/syntax.rb', line 283
 | 
#null_object? ⇒ Object
This is only available when you have enabled the should syntax.
Returns true if this object has received as_null_object
|  | # File 'lib/rspec/mocks/syntax.rb', line 290
 | 
#should_not_receive ⇒ Object
Sets and expectation that this object should not receive a message during this example.
|  | # File 'lib/rspec/mocks/syntax.rb', line 225
 | 
#should_receive ⇒ Object
This is only available when you have enabled the should syntax.
Sets an expectation that this object should receive a message before the end of the example.
|  | # File 'lib/rspec/mocks/syntax.rb', line 212
 | 
#stub ⇒ Object
This is only available when you have enabled the should syntax.
Tells the object to respond to the message with the specified value.
|  | # File 'lib/rspec/mocks/syntax.rb', line 230
 | 
#stub_chain(method1, method2) ⇒ Object #stub_chain("method1.method2") ⇒ Object #stub_chain(method1, method_to_value_hash) ⇒ Object
This is only available when you have enabled the should syntax.
Stubs a chain of methods.
Warning:
Chains can be arbitrarily long, which makes it quite painless to violate the Law of Demeter in violent ways, so you should consider any use of stub_chain a code smell. Even though not all code smells indicate real problems (think fluent interfaces), stub_chain still results in brittle examples. For example, if you write foo.stub_chain(:bar, :baz => 37) in a spec and then the implementation calls foo.baz.bar, the stub will not work.
|  | # File 'lib/rspec/mocks/syntax.rb', line 252
 | 
#unstub ⇒ Object
This is only available when you have enabled the should syntax.
Removes a stub. On a double, the object will no longer respond to message. On a real object, the original method (if it exists) is restored.
This is rarely used, but can be useful when a stub is set up during a shared before hook for the common case, but you want to replace it for a special case.
|  | # File 'lib/rspec/mocks/syntax.rb', line 241
 |