Class: Transpec::Syntax::ShouldReceive::StubRecordBuilder

Inherits:
RecordBuilder
  • Object
show all
Defined in:
lib/transpec/syntax/should_receive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RecordBuilder

build, #build

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