Sha256: a59e9ef67fbed49d3168b03f51a4eb896f8fa4224d9a0f70ffd7d9ada03d61a1

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

RSpec.describe LokaliseRails do
  it 'halts when the API key is not set' do
    allow(described_class).to receive(:api_token).and_return(nil)

    expect(export_executor).to raise_error(SystemExit, /API token is not set/i)
    expect(described_class).to have_received(:api_token)
  end

  it 'halts when the project ID is not set' do
    allow_project_id nil do
      expect(export_executor).to raise_error(SystemExit, /ID is not set/i)
    end
  end

  it 'runs export rake task properly' do
    expect(export_executor).to output(/complete!/).to_stdout
  end

  context 'with two translation files' do
    let(:filename_ru) { 'ru.yml' }
    let(:path_ru) { "#{Rails.root}/config/locales/#{filename_ru}" }
    let(:relative_name_ru) { filename_ru }

    before :all do
      add_translation_files! with_ru: true
    end

    after :all do
      rm_translation_files
    end

    describe '.export!' do
      it 're-raises export errors' do
        allow_project_id

        VCR.use_cassette('upload_files_error') do
          expect(export_executor).to raise_error(SystemExit, /Unknown `lang_iso`/)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lokalise_rails-2.0.0 spec/lib/tasks/export_task_spec.rb
lokalise_rails-2.0.0.rc1 spec/lib/tasks/export_task_spec.rb
lokalise_rails-1.4.0 spec/lib/tasks/export_task_spec.rb