Module Expectations::RecordedExpectation
In: lib/expectations/recorded_expectation.rb

Methods

execute  

Public Instance methods

[Source]

    # File lib/expectations/recorded_expectation.rb, line 2
 2:   def execute
 3:     begin
 4:       mocha_setup
 5:       expected.subject!
 6:       warn_for_expects do
 7:         instance_exec(expected.subject, &block) if block
 8:       end
 9:       if expected.subject.is_a?(Mocha::Mock) &&
10:           !Mocha::Mockery.instance.mocks.include?(expected.subject)
11:         Mocha::Mockery.instance.__send__(:add_mock, expected.subject)
12:       end
13:       if expected.verify! && mocha_verify
14:         self.extend(Expectations::Results::Fulfilled)
15:       else
16:         self.extend(Expectations::Results::StateBasedFailure)
17:         self.message = expected.failure_message
18:       end
19:     rescue Mocha::ExpectationError => ex
20:       self.extend(Expectations::Results::BehaviorBasedFailure)
21:       self.message = expected.mocha_error_message(ex)
22:     rescue Exception => ex
23:       self.extend(Expectations::Results::Error)
24:       self.exception = ex
25:     ensure
26:       mocha_teardown
27:     end
28:     self
29:   end

[Validate]