Sha256: f4e5fcd60615c7f6d305773a050cbb60f3f95636137845c8a61b149bf7eb3af7

Contents?: true

Size: 865 Bytes

Versions: 6

Compression:

Stored size: 865 Bytes

Contents

require 'spec_helper'

describe NetSuite::FieldSupport do
  let(:klass) { Class.new.send(:include, NetSuite::FieldSupport) }
  let(:instance) { klass.new }

  describe '.fields' do
    context 'with arguments' do
      it 'calls .field with each argument passed to it' do
        [:one, :two, :three].each do |field|
          klass.should_receive(:field).with(field)
        end
        klass.fields(:one, :two, :three)
      end
    end

    context 'without arguments' do
      it 'returns a Set of the field arguments' do
        arguments = [:one, :two, :three]
        klass.fields(*arguments)
        klass.fields.should eql(Set.new(arguments))
      end
    end
  end

  describe '.field' do
    it 'defines instance accessor methods for the given field' do
      klass.field(:one)
      instance.one = 1
      instance.one.should eql(1)
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
netsuite-0.0.10 spec/netsuite/field_support_spec.rb
netsuite-0.0.9 spec/netsuite/field_support_spec.rb
netsuite-0.0.8 spec/netsuite/field_support_spec.rb
netsuite-0.0.7 spec/netsuite/field_support_spec.rb
netsuite-0.0.6 spec/netsuite/field_support_spec.rb
netsuite-0.0.5 spec/netsuite/field_support_spec.rb