Class: Expectations::Expectation
- Includes:
- Mocha::Standalone
- Defined in:
- lib/expectations/expectation.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#block ⇒ Object
Returns the value of attribute block.
-
#expected ⇒ Object
Returns the value of attribute expected.
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
-
#initialize(expected, file, line, &block) ⇒ Expectation
constructor
A new instance of Expectation.
- #mock(*args) ⇒ Object
- #warn_for_expects ⇒ Object
Constructor Details
#initialize(expected, file, line, &block) ⇒ Expectation
Returns a new instance of Expectation.
5 6 7 8 9 10 11 12 |
# File 'lib/expectations/expectation.rb', line 5 def initialize(expected, file, line, &block) self.expected, self.block = expected, block self.file, self.line = file, line.to_i case when expected.is_a?(Expectations::Recorder) then extend(Expectations::RecordedExpectation) else extend(Expectations::StateBasedExpectation) end end |
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual.
3 4 5 |
# File 'lib/expectations/expectation.rb', line 3 def actual @actual end |
#block ⇒ Object
Returns the value of attribute block.
3 4 5 |
# File 'lib/expectations/expectation.rb', line 3 def block @block end |
#expected ⇒ Object
Returns the value of attribute expected.
3 4 5 |
# File 'lib/expectations/expectation.rb', line 3 def expected @expected end |
#file ⇒ Object
Returns the value of attribute file.
3 4 5 |
# File 'lib/expectations/expectation.rb', line 3 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
3 4 5 |
# File 'lib/expectations/expectation.rb', line 3 def line @line end |
Instance Method Details
#mock(*args) ⇒ Object
14 15 16 17 |
# File 'lib/expectations/expectation.rb', line 14 def mock(*args) Expectations::StandardError.print "mock method called from #{caller.first.chomp(":in `__instance_exec0'")}\n" super end |
#warn_for_expects ⇒ Object
19 20 21 22 23 24 |
# File 'lib/expectations/expectation.rb', line 19 def warn_for_expects Object.__which_expects__ = ExpectationsExpectsMethod yield ensure Object.__which_expects__ = MochaExpectsMethod end |