Sha256: 5e1eb758f36d39c5c207832e0e4a71ce84a147d571b5630e72bb35049d4be156

Contents?: true

Size: 898 Bytes

Versions: 6

Compression:

Stored size: 898 Bytes

Contents

require 'spec_helper'

def valid_credentials
  {
    :username => 'blablablablabla@example.com',
    :apikey   => '5f64xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx8262'
  }
end

def invalid_credentials
  {
    :username => 'alien',
    :apikey   => 'blabla'
  }
end

describe Mailroute do
  describe '#check_connection' do
    context 'when configured with correct credentials', :vcr => true do

      before do
        Mailroute.configure(valid_credentials)
      end

      it 'should return true' do
        Mailroute.check_connection.should be_true
      end
    end

    context 'when configured with incorrect credentials', :vcr => true do

      before do
        Mailroute.configure(invalid_credentials)
      end

      it 'should raise Unauthorized error' do
        expect {
          Mailroute.check_connection
        }.to raise_error RestClient::Request::Unauthorized
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mailroute-0.0.6 spec/lib/check_connection_spec.rb
mailroute-0.0.5 spec/lib/check_connection_spec.rb
mailroute-0.0.4 spec/lib/check_connection_spec.rb
mailroute-0.0.3 spec/lib/check_connection_spec.rb
mailroute-0.0.2 spec/lib/check_connection_spec.rb
mailroute-0.0.1 spec/lib/check_connection_spec.rb