Sha256: 583eeab5f5fd89308fae32941be465da677ad85eb48e722d9feb8fb28bec3802

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe Lce::Client do
  describe "#http_adapter" do
    it "uses default faraday's adapter as a default" do
      expect(subject.http_adapter).to be(Faraday.default_adapter)

    end
  end
  describe "#host" do
    it 'returns the correct host for the staging environment' do
      expect(subject.host).to eql('https://test.lce.io')
    end

    it 'returns the correct host for the production environment' do
      Lce.configuration.environment = :production
      expect(subject.host).to eql('https://api.lce.io')
    end
  end
  describe "#api version" do
    it 'returns a string of the API version' do
      expect(subject.api_version).to eql('v1')
    end
    it 'needs a valid version' do
      Lce.configuration.api_version = 'api_version'      
      expect { subject.api_version }.to raise_error(Lce::Client::Errors::VersionError)
    end    
  end  
  describe "#path" do
    it 'returns a root path as default' do
      expect(subject.send(:path).to_s).to eql('/')
    end
    context 'with a resource' do
      it 'returns a path with aversion and a resource' do
        Lce.configuration.api_version = 1
        expect(subject.send(:path, :quotes).to_s).to eql('/v1/quotes')
      end

    end
  end    
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lce-0.0.5 spec/lce/client_spec.rb
lce-0.0.4 spec/lce/client_spec.rb
lce-0.0.3 spec/lce/client_spec.rb
lce-0.0.2 spec/lce/client_spec.rb
lce-0.0.1 spec/lce/client_spec.rb