Method: Transpec::Syntax::MethodStub#allowize!

Defined in:
lib/transpec/syntax/method_stub.rb

#allowize!Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/transpec/syntax/method_stub.rb', line 61

def allowize!
  return if method_name == :stub_chain && !rspec_version.receive_message_chain_available?

  unless allow_to_receive_available?
    fail ContextError.new("##{method_name}", '#allow', selector_range)
  end

  source, type = replacement_source_and_conversion_type(rspec_version)
  return unless source

  replace(expression_range, source)

  add_record(AllowRecordBuilder.build(self, type))
end