Sha256: 7711c082a98f07075b8a55ca17d1a4884bf43e8300e57384db633e5ff94adfbe

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 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_not respond_to(:get_soap_endpoint) }
  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 '#get_soap_endpoint' do
    let(:client) { c = Class.new.new.extend(MarketingCloudSDK::Targeting)
      c.stub(:base_api_url).and_return('https://www.exacttargetapis.com')
      c.stub(:access_token).and_return('open_sesame')
      c.stub(:get_soap_endpoint_from_file).and_return(nil)
      c.stub(:set_soap_endpoint_to_file).and_return(nil)
      c.stub(:get)
        .with('https://www.exacttargetapis.com/platform/v1/endpoints/soap',{'access_token'=>'open_sesame'})
        .and_return({'url' => 'S#.authentication.target'})
      c
    }
    it 'sets @endpoint' do
      client.send(:get_soap_endpoint)
      expect(client.endpoint).to eq 'S#.authentication.target'
    end
  end

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

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sfmc-fuelsdk-ruby-1.3.1 spec/targeting_spec.rb
sfmc-fuelsdk-ruby-1.1.0 spec/targeting_spec.rb
dragostsesdk-1.1.0 spec/targeting_spec.rb