Sha256: b94990a099006eca784bd12504f41d9fcf70f4b4257e822a4604f0086815192d

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 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_mock = mock 'logger'
    @config_mock = mock 'config'
    @archive_mock = mock 'archive'
    Trollop.stub(:options).and_return options
    Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
                             and_return @logger_mock
    Heirloom::CLI::Authorize.any_instance.should_receive(:load_config).
                             with(:logger => @logger_mock,
                                  :opts   => options).
                             and_return @config_mock
    Heirloom::Archive.should_receive(:new).
                      with(:id   => '1.0.0',
                           :name => 'archive_name',
                           :config => @config_mock).
                      and_return @archive_mock
    @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

1 entries across 1 versions & 1 rubygems

Version Path
heirloom-0.4.0 spec/cli/authorize_spec.rb