Class: Transpec::Syntax::ShouldReceive::StubRecord

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

Constant Summary

Constants inherited from Record

Record::OVERRIDDE_FORBIDDEN_METHODS

Instance Attribute Summary

Attributes inherited from Record

#annotation, #converted_syntax_type, #original_syntax_type

Instance Method Summary collapse

Methods inherited from Record

#==, #converted_syntax, #hash, #original_syntax, #to_s

Constructor Details

#initialize(should_receive) ⇒ StubRecord

Returns a new instance of StubRecord.



215
216
217
# File 'lib/transpec/syntax/should_receive.rb', line 215

def initialize(should_receive, *)
  @should_receive = should_receive
end

Instance Method Details

#build_converted_syntaxObject



226
227
228
# File 'lib/transpec/syntax/should_receive.rb', line 226

def build_converted_syntax
  'obj.stub(:message)'
end

#build_original_syntaxObject



219
220
221
222
223
224
# File 'lib/transpec/syntax/should_receive.rb', line 219

def build_original_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