Class: Evil::Client::RSpec::AllowStub

Inherits:
BaseStub
  • Object
show all
Defined in:
lib/evil/client/rspec/allow_stub.rb

Overview

Container to chain settings for allowing operation(s)

Instance Method Summary collapse

Methods inherited from BaseStub

#with

Instance Method Details

#to_call_originalObject



19
20
21
22
23
# File 'lib/evil/client/rspec/allow_stub.rb', line 19

def to_call_original
  allow(Evil::Client::Container::Operation)
    .to follow_expectation
    .and_call_original
end

#to_raise(error = StandardError, *args) ⇒ Object



13
14
15
16
17
# File 'lib/evil/client/rspec/allow_stub.rb', line 13

def to_raise(error = StandardError, *args)
  allow(Evil::Client::Container::Operation)
    .to follow_expectation
    .and_return proc { raise(error, *args) }
end

#to_return(response = nil) ⇒ Object



7
8
9
10
11
# File 'lib/evil/client/rspec/allow_stub.rb', line 7

def to_return(response = nil)
  allow(Evil::Client::Container::Operation)
    .to follow_expectation
    .and_return double(:operation, call: response)
end