Sha256: 877173f84669cda7b4e709691432a010a036c728cea99b2595634774e89c393f

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 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(
        :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 => @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

3 entries across 3 versions & 1 rubygems

Version Path
localeapp-0.6.2 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.1 spec/localeapp/cli/pull_spec.rb
localeapp-0.6.0 spec/localeapp/cli/pull_spec.rb