Sha256: c6032694795294bf885e9310f3f55ec29c40df2ad3b1001387bef917e289940f

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'
require 'smartling/client'

describe Smartling::Client, :vcr do
  let(:options) { {} }
  let(:client) { Smartling::Client.new(options) }

  it('knows context') { assert client.is_a?(Smartling::Contexts) }
  it('knows about files') { assert client.is_a?(Smartling::Files) }
  it('knows about strings') { assert client.is_a?(Smartling::Strings) }
  it('knows how to authenticate') { assert client.is_a?(Smartling::Auth) }

  it 'can be created with options' do
    c = Smartling::Client.new(project_id: 3)
    refute_nil c.user_id
    refute_nil c.user_secret
    assert_equal 3, c.project_id
  end

  it 'is cool with bullshit' do
    path = '/no/such/path'
    assert_raises { Smartling::Client.new.get(path) }
  end

  it 'explains when credentials are borked' do
    path = '/auth-api/v2/authorize'
    assert_raises do
      Smartling::Client.new(user_id: 'no', user_secret: 'way').get(path)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smartring-0.0.2 test/smartling/client_test.rb
smartring-0.0.1 test/smartling/client_test.rb