Class Expectations::Expectation
In: lib/expectations/expectation.rb
Parent: Object

Methods

mock   new   warn_for_expects  

Included Modules

Mocha::API

Attributes

actual  [RW] 
block  [RW] 
expected  [RW] 
file  [RW] 
line  [RW] 

Public Class methods

[Source]

    # File lib/expectations/expectation.rb, line 5
 5:   def initialize(expected, file, line, &block)
 6:     self.expected = expected
 7:     self.block = block
 8:     self.file, self.line = file, line.to_i
 9: 
10:     if expected.is_a?(Expectations::Recorder)
11:       extend(Expectations::RecordedExpectation)
12:     elsif !block
13:       extend(Expectations::RecordedExpectation)
14:       self.expected = Expectations::Recorder.new(self.expected)
15:       self.expected.extend(Expectations::StateBasedRecorder)
16:       self.expected.extend(Expectations::StateBasedRecorderForExpectationsWithoutBlock)
17:       self.expected.file = file
18:       self.expected.line = line
19:     else
20:       extend(Expectations::StateBasedExpectation)
21:     end
22:   end

Public Instance methods

[Source]

    # File lib/expectations/expectation.rb, line 24
24:   def mock(*args)
25:     Expectations::StandardError.print "mock method called from #{caller.first.chomp(":in `__instance_exec0'")}\n"
26:     super
27:   end

[Source]

    # File lib/expectations/expectation.rb, line 29
29:   def warn_for_expects
30:     Object.__which_expects__ = ExpectationsExpectsMethod
31:     yield
32:   ensure
33:     Object.__which_expects__ = MochaExpectsMethod
34:   end

[Validate]