Class: RailsMocks::Stub
- Inherits:
-
Object
- Object
- RailsMocks::Stub
- Includes:
- RSpec::Mocks::ExampleMethods
- Defined in:
- lib/rails_mocks/stub.rb
Instance Method Summary collapse
- #execute(scope) ⇒ Object
-
#initialize(stub) ⇒ Stub
constructor
A new instance of Stub.
Constructor Details
#initialize(stub) ⇒ Stub
Returns a new instance of Stub.
7 8 9 |
# File 'lib/rails_mocks/stub.rb', line 7 def initialize(stub) @stub = stub end |
Instance Method Details
#execute(scope) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rails_mocks/stub.rb', line 11 def execute(scope) if stub[:allow] scope.allow(allow).to(receiver) elsif stub[:allow_any_instance_of] scope.allow_any_instance_of(allow_any_instance_of).to(receiver) end end |