Sha256: f35282ec83b97521cf8b0d2417e3a54b3c49e0ec7dda1814da9c47f92db1790d

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 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)
  end

  it "makes the api call to the translations endpoint" do
    with_configuration do
      @puller.should_receive(:api_call).with(
        :translations,
        :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)
  end

  it "calls the updater" do
    with_configuration do
      Localeapp.poller.stub!(:write_synchronization_data!)
      Localeapp.updater.should_receive(:update).with(['test data'])
      @puller.update_backend(@test_data)
    end
  end

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
localeapp-0.5.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.5.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.5.0 spec/localeapp/cli/pull_spec.rb
localeapp-0.4.3 spec/localeapp/cli/pull_spec.rb
localeapp-0.4.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.4.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.4.0 spec/localeapp/cli/pull_spec.rb
localeapp-0.3.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.3.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.3.0 spec/localeapp/cli/pull_spec.rb
localeapp-0.2.0 spec/localeapp/cli/pull_spec.rb
localeapp-0.1.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.1.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.0.11 spec/localeapp/cli/pull_spec.rb
localeapp-0.0.10 spec/localeapp/cli/pull_spec.rb
localeapp-0.0.8 spec/localeapp/cli/pull_spec.rb