Sha256: d8a99168be6bff55757a4d2181713effbd2fe98c515769cd9f381e8f7988058e

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do
    options = { :level    => 'info',
                :accounts => ['test@test.com'],
                :name     => 'archive_name',
                :id       => '1.0.0' }
    @logger_stub = stub
    @config_mock = mock 'config'
    @archive_mock = mock 'archive'
    @config_mock.stub :logger     => @logger_stub,
                      :access_key => 'key',
                      :secret_key => 'secret'
    Trollop.stub(:options).and_return options
    Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
                             and_return @logger_stub
    Heirloom::CLI::Authorize.any_instance.should_receive(:load_config).
                             with(:logger => @logger_stub,
                                  :opts   => options).
                             and_return @config_mock
    Heirloom::Archive.should_receive(:new).
                      with(:name => 'archive_name',
                           :config => @config_mock).
                      and_return @archive_mock
    Heirloom::Archive.should_receive(:new).
                      with(:id   => '1.0.0',
                           :name => 'archive_name',
                           :config => @config_mock).
                      and_return @archive_mock
    @archive_mock.should_receive(:domain_exists?).and_return true
    @cli_authorize = Heirloom::CLI::Authorize.new
  end

  it "should authorize an account" do
    @archive_mock.should_receive(:authorize).with ['test@test.com']
    @cli_authorize.authorize
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heirloom-0.5.0rc3 spec/cli/authorize_spec.rb
heirloom-0.5.0rc2 spec/cli/authorize_spec.rb
heirloom-0.5.0rc1 spec/cli/authorize_spec.rb