Class: Transpec::Syntax::ShouldReceive::StubRecordBuilder
- Inherits:
-
RecordBuilder
- Object
- RecordBuilder
- Transpec::Syntax::ShouldReceive::StubRecordBuilder
- Defined in:
- lib/transpec/syntax/should_receive.rb
Instance Attribute Summary collapse
-
#should_receive ⇒ Object
readonly
Returns the value of attribute should_receive.
Instance Method Summary collapse
-
#initialize(should_receive) ⇒ StubRecordBuilder
constructor
A new instance of StubRecordBuilder.
- #new_syntax ⇒ Object
- #old_syntax ⇒ Object
Methods inherited from RecordBuilder
Constructor Details
#initialize(should_receive) ⇒ StubRecordBuilder
Returns a new instance of StubRecordBuilder.
218 219 220 |
# File 'lib/transpec/syntax/should_receive.rb', line 218 def initialize(should_receive) @should_receive = should_receive end |
Instance Attribute Details
#should_receive ⇒ Object (readonly)
Returns the value of attribute should_receive.
216 217 218 |
# File 'lib/transpec/syntax/should_receive.rb', line 216 def should_receive @should_receive end |
Instance Method Details
#new_syntax ⇒ Object
229 230 231 |
# File 'lib/transpec/syntax/should_receive.rb', line 229 def new_syntax 'obj.stub(:message)' end |
#old_syntax ⇒ Object
222 223 224 225 226 227 |
# File 'lib/transpec/syntax/should_receive.rb', line 222 def old_syntax syntax = "obj.#{should_receive.method_name}(:message)" syntax << '.any_number_of_times' if should_receive.any_number_of_times? syntax << '.at_least(0)' if should_receive.at_least_zero? syntax end |