Sha256: 06671b1fe13de3a73fe77d0231c36407d3f2893b9051ee285067a504a6b187e2

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

RSpec.describe Chartmogul::V1::Customers do

  let(:client) { Chartmogul::Client.new }

  describe '#attributes' do
    subject { client.customers.attributes }

    it { expect(subject).to be_a Chartmogul::V1::Customers::Attributes }
    it { expect(subject.client).to eq client }
  end

  describe '::Attributes' do
    describe '#create' do
      let(:url) { 'https://api.chartmogul.com/v1/customers/customer-id/attributes/custom' }
      let(:query) { { foo: 'bar' } }

      before do
        stub_request(:post, url).with(query: query).to_return(status: 200)
      end

      subject { client.customers.attributes.create('customer-id', query) }

      it_should_behave_like 'a base ChartMogul API V1 requests', method: :post
    end

    describe '#update' do
      let(:url) { 'https://api.chartmogul.com/v1/customers/customer-id/attributes/custom' }
      let(:query) { { foo: 'bar' } }

      before do
        stub_request(:put, url).with(query: query).to_return(status: 200)
      end

      subject { client.customers.attributes.update('customer-id', query) }

      it_should_behave_like 'a base ChartMogul API V1 requests', method: :put
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chartmogul_client-0.0.2 spec/chartmogul/v1/customers_spec.rb
chartmogul_client-0.0.1 spec/chartmogul/v1/customers_spec.rb