Sha256: 2808cbe88bd7f19ec037d3524830f809dd6555841ba53833e0fcf68e9df56f97

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe NetSuite::Records::CustomerSubscription do

  before do
    NetSuite::Configuration.api_version = '2014_2'
  end

  let(:attributes) do
    {
      :subscription => {
        :subscribed          => true,
        :subscription        => NetSuite::Records::RecordRef.new(internal_id: '123123', name: 'My Sub'),
        :last_modified_date  => DateTime.new(2018, 1, 1, 0, 0, 0)
      }
    }
  end

  let(:list) { NetSuite::Records::CustomerSubscription.new(attributes) }

  it 'has all the right fields' do
    [
      :subscribed, :last_modified_date
    ].each do |field|
      expect(list).to have_field(field)
    end

    expect(list.subscription).to_not be_nil
  end

  describe '#initialize' do
    context 'when taking in a hash of attributes' do
      it 'sets the attributes for the object given the attributes hash' do
        expect(list.subscription.subscribed).to eql(true)
        expect(list.subscription.subscription.internal_id).to eql('123123')
        expect(list.subscription.subscription.name).to eql('My Sub')
        expect(list.subscription.last_modified_date).to_not be_nil
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
netsuite-0.8.12 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.11 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.10 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.9 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.8 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.7 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.6 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.5 spec/netsuite/records/customer_subscription_spec.rb
netsuite-0.8.4 spec/netsuite/records/customer_subscription_spec.rb