Sha256: 04a89f2a88ace9aac97016d349b396b16a7815bef7ef8055996487828b378402

Contents?: true

Size: 1.74 KB

Versions: 9

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

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

    describe '#add_string' do
      it 'when request are valid', :default do
        stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings")
        add_string = @crowdin.add_string({}, project_id)
        expect(add_string).to eq(200)
      end
    end

    describe '#get_string' do
      let(:string_id) { 1 }

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

    describe '#delete_string' do
      let(:string_id) { 1 }

      it 'when request are valid', :default do
        stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/#{string_id}")
        delete_string = @crowdin.delete_string(string_id, project_id)
        expect(delete_string).to eq(200)
      end
    end

    describe '#edit_string' do
      let(:string_id) { 1 }

      it 'when request are valid', :default do
        stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/#{string_id}")
        edit_string = @crowdin.edit_string(string_id, {}, project_id)
        expect(edit_string).to eq(200)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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