Sha256: 872c5af8001f8d444847b5546d5dab4fb84e8b09cb17227c083b76e272dd21f4

Contents?: true

Size: 856 Bytes

Versions: 6

Compression:

Stored size: 856 Bytes

Contents

require 'spec_helper'

describe Localeapp::CLI::Push, "#execute(file)" do
  before do
    @output = StringIO.new
    @pusher = Localeapp::CLI::Push.new(@output)
  end

  it "creates a new file object and makes the api call to the translations endpoint" do
    with_configuration do
      file = double('file')
      file_path = 'test_path'
      @pusher.stub!(:sanitize_file).and_return(file)
      @pusher.should_receive(:api_call).with(
        :import,
        :payload => { :file => file },
        :success => :report_success,
        :failure => :report_failure,
        :max_connection_attempts => 3
      )
      @pusher.execute(file_path)
    end
  end

  it "doesn't make the api call when the file doesn't exist" do
    @pusher.stub!(:sanitize_file).and_return(nil)
    @pusher.should_not_receive(:api_call)
    @pusher.execute('foo')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
localeapp-0.2.0 spec/localeapp/cli/push_spec.rb
localeapp-0.1.2 spec/localeapp/cli/push_spec.rb
localeapp-0.1.1 spec/localeapp/cli/push_spec.rb
localeapp-0.0.11 spec/localeapp/cli/push_spec.rb
localeapp-0.0.10 spec/localeapp/cli/push_spec.rb
localeapp-0.0.8 spec/localeapp/cli/push_spec.rb