Sha256: 429443e7f86cff41c455a91b814b2e37504e0cf6a58f42eadc59e516c8aaf615

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe 'Configuration' do
  context '.authenticated_url' do
    context 'with non-standard port number' do
      it 'sets the API key and endpoint' do
        Swiftype.authenticated_url = 'http://testkey:@localhost:1234/api/v1'
        Swiftype.api_key.should == 'testkey'
        Swiftype.endpoint.should == 'http://localhost:1234/api/v1/'
      end

      context 'with implicit port number' do
        Swiftype.authenticated_url = 'https://testkey:@api.swiftype.com/api/v1'
        Swiftype.api_key.should == 'testkey'
        Swiftype.endpoint.should == 'https://api.swiftype.com/api/v1/'
      end
    end
  end

  context '.endpoint' do
    context 'with a trailing /' do
      it 'adds / to the end of of the URL' do
        Swiftype.endpoint = 'https://api.swiftype.com/api/v1'
        Swiftype.endpoint.should == 'https://api.swiftype.com/api/v1/'
      end
    end

    context 'with a trailing /' do
      it 'leaves the URL alone' do
        Swiftype.endpoint = 'https://api.swiftype.com/api/v1/'
        Swiftype.endpoint.should == 'https://api.swiftype.com/api/v1/'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
swiftype-1.1.0 spec/configuration_spec.rb
swiftype-1.0.1 spec/configuration_spec.rb
swiftype-1.0.0 spec/configuration_spec.rb