Sha256: c9be6d051649bc81ef7874e5eb22b82c40b5ae6a3ca08b27bc8bedfb48fa504e

Contents?: true

Size: 889 Bytes

Versions: 7

Compression:

Stored size: 889 Bytes

Contents

require "rails_helper"

describe MnoEnterprise::ImpacClient do
  subject { MnoEnterprise::ImpacClient }

  let(:host_path) { "http://localhost:4000" }
  let(:params) { { sso_session: '1234' } }
  let(:endpoint) { "/some/endpoint" }
  let(:url) { "http://localhost:4000/some/endpoint?sso_session=1234" }

  describe ".host" do
    it { expect(subject.host).to eq(host_path) }
  end

  describe ".endpoint_url" do
    it { expect(subject.endpoint_url(endpoint, params)).to eq(url) }
    context "when the endpoint misses the first '/'" do
      let(:endpoint) { "some/endpoint" }
      it { expect(subject.endpoint_url(endpoint, params)).to eq(url) }
    end
  end

  describe ".send_get" do
    let(:opts) { {some: 'opts'} }

    before { allow(subject).to receive(:get).with(url, opts).and_return(true) }

    it { expect(subject.send_get(endpoint, params, opts)).to eq(true) }
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 spec/lib/mno_enterprise/impac_client_spec.rb
mno-enterprise-core-3.3.3 spec/lib/mno_enterprise/impac_client_spec.rb
mno-enterprise-core-3.3.2 spec/lib/mno_enterprise/impac_client_spec.rb
mno-enterprise-core-3.2.1 spec/lib/mno_enterprise/impac_client_spec.rb
mno-enterprise-core-3.3.1 spec/lib/mno_enterprise/impac_client_spec.rb
mno-enterprise-core-3.3.0 spec/lib/mno_enterprise/impac_client_spec.rb
mno-enterprise-core-3.2.0 spec/lib/mno_enterprise/impac_client_spec.rb