Sha256: 0320f75a25fb80643d3704a88bbb4679932f982cc05c13ef6da542e95b354b48

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

# Copyright 2022 Daniel Herzog
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE.md file.
# frozen_string_literal: true

require 'spec_helper'

describe DeepL::Requests::Glossary::LanguagePairs do
  subject(:language_pairs_obj) { described_class.new(api, options) }

  around do |tests|
    tmp_env = replace_env_preserving_deepl_vars_except_mock_server
    tests.call
    ENV.replace(tmp_env)
  end

  let(:api) { build_deepl_api }
  let(:options) { {} }

  describe '#initialize' do
    context 'when building a request' do
      it 'creates a request object' do
        expect(language_pairs_obj).to be_a(described_class)
      end
    end
  end

  describe '#request' do
    around do |example|
      VCR.use_cassette('glossaries') { example.call }
    end

    context 'when requesting a list of all language pairs supported by glossaries' do
      it 'returns a language pairs object' do
        language_pairs = language_pairs_obj.request
        expect(language_pairs).to be_an(Array)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deepl-rb-3.1.0 spec/requests/glossary/language_pairs_spec.rb
deepl-rb-3.0.2 spec/requests/glossary/language_pairs_spec.rb
deepl-rb-3.0.1 spec/requests/glossary/language_pairs_spec.rb
deepl-rb-3.0.0 spec/requests/glossary/language_pairs_spec.rb