Sha256: d015717c8b360af650aeea3d9cbe3034dae8ee9b1c5b78930e51364b163e173b

Contents?: true

Size: 1.82 KB

Versions: 10

Compression:

Stored size: 1.82 KB

Contents

# frozen_string_literal: true

describe Crowdin::ApiResources::MachineTranslationEngines do
  describe 'Default endpoints' do
    describe '#list_mts' do
      it 'when request are valid', :default do
        stub_request(:get, "https://api.crowdin.com/#{target_api_url}/mts")
        list_mts = @crowdin.list_mts
        expect(list_mts).to eq(200)
      end
    end

    describe '#get_mt' do
      let(:mt_id) { 1 }

      it 'when request are valid', :default do
        stub_request(:get, "https://api.crowdin.com/#{target_api_url}/mts/#{mt_id}")
        get_mt = @crowdin.get_mt(mt_id)
        expect(get_mt).to eq(200)
      end
    end

    describe '#translate_via_mt' do
      let(:mt_id) { 1 }

      it 'when request are valid', :default do
        stub_request(:post, "https://api.crowdin.com/#{target_api_url}/mts/#{mt_id}/translations")
        translate_via_mt = @crowdin.translate_via_mt(mt_id)
        expect(translate_via_mt).to eq(200)
      end
    end
  end

  describe 'Enterprise endpoints' do
    describe '#edit_mt' do
      let(:mt_id) { 1 }

      it 'when request are valid', :enterprise do
        stub_request(:patch, "https://domain.api.crowdin.com/#{target_api_url}/mts/#{mt_id}")
        edit_mt = @crowdin.edit_mt(mt_id)
        expect(edit_mt).to eq(200)
      end
    end

    describe '#add_mt' do
      it 'when request are valid', :enterprise do
        stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/mts")
        add_mt = @crowdin.add_mt
        expect(add_mt).to eq(200)
      end
    end

    describe '#delete_mt' do
      let(:mt_id) { 1 }

      it 'when request are valid', :enterprise do
        stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/mts/#{mt_id}")
        delete_mt = @crowdin.delete_mt(mt_id)
        expect(delete_mt).to eq(200)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
crowdin-api-1.12.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.10.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.9.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.8.1 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.8.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.7.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.6.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.5.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.4.0 spec/api_resources/machine_translation_engines_spec.rb
crowdin-api-1.3.0 spec/api_resources/machine_translation_engines_spec.rb