Sha256: 4b5f7464a506f11f245f5cfb46d5fde70c93de7e336f597bb9edcc1d22550fc4

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe MarketingCloudSDK::Targeting do

  subject { Class.new.new.extend(MarketingCloudSDK::Targeting) }

  it { should respond_to(:endpoint) }
  it { should_not respond_to(:endpoint=) }
  it { should respond_to(:determine_stack) }
  it { should respond_to(:get) }
  it { should respond_to(:post) }
  it { should respond_to(:patch) }
  it { should respond_to(:delete) }
  it { should respond_to(:access_token) }

  describe '#determine_stack' do
    let(:client) { c = Class.new.new.extend(MarketingCloudSDK::Targeting)
      c.stub(:access_token).and_return('open_sesame')
      c.stub(:get)
        .with('https://www.exacttargetapis.com/platform/v1/endpoints/soap',{'params'=>{'access_token'=>'open_sesame'}})
        .and_return({'url' => 'S#.authentication.target'})
      c
    }
    it 'sets @endpoint' do
      expect(client.send(:determine_stack)).to eq 'S#.authentication.target'
    end
  end

  describe '#endpoint' do
    let(:client) { c = Class.new.new.extend(MarketingCloudSDK::Targeting)
      c.stub(:get).and_return({'url' => 'S#.authentication.target'})
      c
    }

    it 'calls determine_stack to find target' do
      expect(client.endpoint).to eq 'S#.authentication.target'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marketingcloudsdk-1.0.0 spec/targeting_spec.rb