Module Expectations::StateBasedExpectation
In: lib/expectations/state_based_expectation.rb

Methods

execute  

Public Instance methods

[Source]

    # File lib/expectations/state_based_expectation.rb, line 2
 2:   def execute
 3:     begin
 4:       mocha_setup
 5:       warn_for_expects do
 6:         unless block
 7:           self.actual = false
 8:         else
 9:           self.actual = instance_eval(&block)
10:         end
11:       end
12:       mocha_verify
13:       if expected.expectations_equal_to(actual)
14:         self.extend(Expectations::Results::Fulfilled)
15:       else
16:         self.extend(Expectations::Results::StateBasedFailure)
17:       end
18:     rescue Exception => ex
19:       return self.extend(Expectations::Results::Fulfilled) if expected == ex.class
20:       self.extend(Expectations::Results::Error)
21:       self.exception = ex
22:       self.message = "expected: <#{expected.inspect}> got: <#{ex.class.inspect}>" if expected.is_a?(Class) && expected < StandardError
23:       return self
24:     ensure
25:       mocha_teardown
26:     end
27:   end

[Validate]