Sha256: 8995acce068cdcfa7565f1d78508de3fe005f339ceaf925f3a9ef719a53b8463

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'locale_app/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

1 entries across 1 versions & 1 rubygems

Version Path
localeapp-0.0.7 spec/locale_app/cli/pull_spec.rb