Sha256: 5e93a57682726779506383bd634e3dbf0eb7c30fb7b68c8df3cdaa6da9486f36

Contents?: true

Size: 815 Bytes

Versions: 49

Compression:

Stored size: 815 Bytes

Contents

RSpec::Matchers.define :have_record_ref do |attribute|

  match do |model|
    record_ref_can_be_set_and_retrieved?(model, attribute) && record_ref_can_be_set_on_instantiation?(model, attribute)
  end

  def record_ref_can_be_set_and_retrieved?(model, attribute)
    model.send("#{attribute}=".to_sym, attributes)
    model.send(attribute).should be_kind_of(NetSuite::Records::RecordRef)
  end

  def record_ref_can_be_set_on_instantiation?(model, attribute)
    new_model = model.class.new(attribute => attributes)
    new_model.send(attribute).should be_kind_of(NetSuite::Records::RecordRef)
  end

  def attributes
    {
      :@internal_id           => '125',
      :"@xmlns:platform_core" => 'urn:core_2011_2.platform.webservices.netsuite.com',
      :name                   => 'RP RecordRef'
    }
  end

end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
netsuite-0.3.0 spec/support/record_ref_matcher.rb
netsuite-0.2.6 spec/support/record_ref_matcher.rb
netsuite-0.2.5 spec/support/record_ref_matcher.rb
netsuite-0.2.4 spec/support/record_ref_matcher.rb
netsuite-0.2.3 spec/support/record_ref_matcher.rb
netsuite-0.2.2 spec/support/record_ref_matcher.rb
netsuite-0.2.1 spec/support/record_ref_matcher.rb
netsuite-0.2.0 spec/support/record_ref_matcher.rb
netsuite-0.1.0 spec/support/record_ref_matcher.rb
netsuite-0.0.50 spec/support/record_ref_matcher.rb
netsuite-0.0.49 spec/support/record_ref_matcher.rb
netsuite-0.0.48 spec/support/record_ref_matcher.rb
netsuite-0.0.47 spec/support/record_ref_matcher.rb
netsuite-0.0.45 spec/support/record_ref_matcher.rb
netsuite-0.0.44 spec/support/record_ref_matcher.rb
netsuite-0.0.43 spec/support/record_ref_matcher.rb
netsuite-0.0.42 spec/support/record_ref_matcher.rb
netsuite-0.0.41 spec/support/record_ref_matcher.rb
netsuite-0.0.40 spec/support/record_ref_matcher.rb
netsuite-0.0.39 spec/support/record_ref_matcher.rb