Sha256: 761a7085dc16635198880468bf2cd9c19871d79b4d4ce2f6f6db478ec6135291

Contents?: true

Size: 806 Bytes

Versions: 25

Compression:

Stored size: 806 Bytes

Contents

require 'spec_helper'

describe NetSuite::Rest::Utilities::Request do
  subject { described_class }

  describe '#get' do
    it { is_expected.to respond_to :get }
    let(:default_args) do
      { email: 'jim@godaddy.com', password: 'secret', uri: '/sandwich'}
    end

    [:email, :password, :uri].each do |key|
      it "throws an error if no #{key} key is given" do
        expect{
          subject.get(default_args.delete_if{|x| x == key})
        }.to raise_error(KeyError)
      end
    end

    it 'returns an array with the response code and parsed body' do
      allow(subject).to receive(:make_request).and_return(
        double(:response, code: "200", body: [{great: :body}].to_json)
      )
      expect( subject.get(default_args) ).to eq ["200", [{"great" => "body"}]]
    end
  end


end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
netsuite-0.9.3 spec/netsuite/utilities/request_spec.rb
netsuite-0.9.2 spec/netsuite/utilities/request_spec.rb
netsuite-0.9.1 spec/netsuite/utilities/request_spec.rb
netsuite-0.9.0 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.12 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.11 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.10 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.9 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.8 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.7 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.6 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.5 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.4 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.3 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.2 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.1 spec/netsuite/utilities/request_spec.rb
netsuite-0.8.0 spec/netsuite/utilities/request_spec.rb
netsuite-0.7.9 spec/netsuite/utilities/request_spec.rb
netsuite-0.7.8 spec/netsuite/utilities/request_spec.rb
netsuite-0.7.7 spec/netsuite/utilities/request_spec.rb