Sha256: 7dd19b5d366c3df2c553ee6494759412d997941e86cc366d77e2a8eaa3728751

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'localeapp/cli/pull'

describe Localeapp::CLI::Pull, "#execute" do
  before do
    @output = StringIO.new
    @puller = Localeapp::CLI::Pull.new(:output => @output)
  end

  it "makes the api call to the translations endpoint" do
    with_configuration do
      expect(@puller).to receive(:api_call).with(
        :export,
        :success => :update_backend,
        :failure => :report_failure,
        :max_connection_attempts => anything
      )
      @puller.execute
    end
  end
end

describe Localeapp::CLI::Pull, "#update_backend(response)" do
  before do
    @test_data = ['test data'].to_json
    @output = StringIO.new
    @puller = Localeapp::CLI::Pull.new(:output => @output)
  end

  it "calls the updater" do
    with_configuration do
      allow(Localeapp.poller).to receive(:write_synchronization_data!)
      expect(Localeapp.updater).to receive(:dump).with(['test data'])
      @puller.update_backend(@test_data)
    end
  end

  it "writes the synchronization data" do
    with_configuration do
      allow(Localeapp.updater).to receive(:dump)
      expect(Localeapp.poller).to receive(:write_synchronization_data!)
      @puller.update_backend(@test_data)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
localeapp-3.3.0 spec/localeapp/cli/pull_spec.rb
localeapp-3.2.0 spec/localeapp/cli/pull_spec.rb
localeapp-3.1.3 spec/localeapp/cli/pull_spec.rb
localeapp-3.1.2 spec/localeapp/cli/pull_spec.rb
localeapp-3.1.1 spec/localeapp/cli/pull_spec.rb
localeapp-3.1.0 spec/localeapp/cli/pull_spec.rb
localeapp-3.0.1 spec/localeapp/cli/pull_spec.rb
localeapp-3.0.0 spec/localeapp/cli/pull_spec.rb
localeapp-2.5.0 spec/localeapp/cli/pull_spec.rb
localeapp-2.4.0 spec/localeapp/cli/pull_spec.rb
localeapp-2.3.0 spec/localeapp/cli/pull_spec.rb
localeapp-2.2.0 spec/localeapp/cli/pull_spec.rb