Sha256: 6b83c42ff6e7ccb68b4500a9b60b1582ed1c565d2709f503f863624d2026c93c

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 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
      @puller.should_receive(:api_call).with(
        :export,
        :success => :update_backend,
        :failure => :report_failure,
        :max_connection_attempts => 3
      )
      @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
      Localeapp.poller.stub(:write_synchronization_data!)
      Localeapp.updater.should_receive(:dump).with(['test data'])
      @puller.update_backend(@test_data)
    end
  end

  it "writes the synchronization data" do
    with_configuration do
      Localeapp.updater.stub(:dump)
      Localeapp.poller.should_receive(:write_synchronization_data!)
      @puller.update_backend(@test_data)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
localeapp-0.9.3 spec/localeapp/cli/pull_spec.rb
localeapp-0.9.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.9.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.9.0 spec/localeapp/cli/pull_spec.rb
localeapp-0.8.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.8.0 spec/localeapp/cli/pull_spec.rb
localeapp-0.7.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.7.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.7.0 spec/localeapp/cli/pull_spec.rb