Sha256: 26f3c153ff0819d84eb3ba2e44cfbda44105871c8def2aefb43970fa7bade4fd

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

# These tests use real network connections to test the SSL
# support. Since a real API key is not used, the success condition is
# that the connection was made and the approriate error message is
# returned from the API
describe 'SSL support' do
  let(:client) { Swiftype::Client.new }

  context 'when the endpoint is configured to use SSL' do
    it 'connects successfully' do
      Swiftype.endpoint = 'https://api.swiftype.com/api/v1/'

      VCR.turned_off do
        WebMock.allow_net_connect!
        expect do
          client.search('swiftype-api-example', 'test')
        end.to raise_error(Swiftype::InvalidCredentials)
      end
    end
  end

  context 'when the endpoint is configured not to use SSL' do
    it 'connects successfully' do
      Swiftype.endpoint = 'http://api.swiftype.com/api/v1/'
      VCR.turned_off do
        WebMock.allow_net_connect!
        expect do
          client.search('swiftype-api-example', 'test')
        end.to raise_error(Swiftype::InvalidCredentials)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
swiftype-1.5.2 spec/ssl_spec.rb
swiftype-1.5.0 spec/ssl_spec.rb
swiftype-1.4.0 spec/ssl_spec.rb
swiftype-1.3.1 spec/ssl_spec.rb
swiftype-1.3.0 spec/ssl_spec.rb
swiftype-1.2.3 spec/ssl_spec.rb
swiftype-1.2.2 spec/ssl_spec.rb
swiftype-1.2.1 spec/ssl_spec.rb
swiftype-1.2.0 spec/ssl_spec.rb
swiftype-1.1.0 spec/ssl_spec.rb
swiftype-1.0.1 spec/ssl_spec.rb
swiftype-1.0.0 spec/ssl_spec.rb