Class: ExpectsChain::Expectation
- Defined in:
- lib/expects_chain/expectation.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, object, *args) ⇒ Expectation
constructor
A new instance of Expectation.
- #raises(exception) ⇒ Object
- #returns(value) ⇒ Object
Constructor Details
#initialize(type, object, *args) ⇒ Expectation
Returns a new instance of Expectation.
3 4 5 6 7 |
# File 'lib/expects_chain/expectation.rb', line 3 def initialize type, object, *args @type = type @object = object @expectations = args end |
Class Method Details
.mocker ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/expects_chain/expectation.rb', line 21 def self.mocker if @_mocker.nil? framework = RSpec.configuration.mock_framework.framework_name.to_s.capitalize.to_sym raise StandardError.new("expects_chain unsupported framework: #{framework}") unless Mockers.constants.include?(framework) @_mocker = Mockers::const_get(framework) end @_mocker end |
Instance Method Details
#raises(exception) ⇒ Object
15 16 17 18 19 |
# File 'lib/expects_chain/expectation.rb', line 15 def raises exception @rtype = :raises set_up_call_chain exception exception end |
#returns(value) ⇒ Object
9 10 11 12 13 |
# File 'lib/expects_chain/expectation.rb', line 9 def returns value @rtype = :returns set_up_call_chain value value end |