Class: Hardmock::StubbedMethod

Inherits:
ReplacedMethod show all
Defined in:
lib/hardmock/stubbing.rb

Overview

:nodoc:#

Instance Attribute Summary

Attributes inherited from ReplacedMethod

#method_name, #target

Instance Method Summary collapse

Methods inherited from ReplacedMethod

#initialize

Constructor Details

This class inherits a constructor from Hardmock::ReplacedMethod

Instance Method Details

#invoke(args) ⇒ Object

Raises:



67
68
69
70
# File 'lib/hardmock/stubbing.rb', line 67

def invoke(args)
  raise @raises if @raises
  @return_value
end

#raises(err) ⇒ Object



76
77
78
79
# File 'lib/hardmock/stubbing.rb', line 76

def raises(err)
  err = RuntimeError.new(err) unless err.kind_of?(Exception)
  @raises = err
end

#returns(stubbed_return) ⇒ Object



72
73
74
# File 'lib/hardmock/stubbing.rb', line 72

def returns(stubbed_return)
  @return_value = stubbed_return
end