Sha256: bbd941e358b4300441fb0729ca470f3f1ad616ba0c1139560dc77af8a08a4e8a

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 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

11 entries across 11 versions & 1 rubygems

Version Path
localeapp-0.6.14 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.13 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.12 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.10 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.9 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.8 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.7 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.6 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.5 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.4 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.3 spec/localeapp/cli/pull_spec.rb