Sha256: 42f4f4d810479e7501201429e755c3cfb92699676d9d6dcabb577c6ec1fdf4df

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do

    options = { :name           => 'archive_name',
                :id             => '1.0.0',
                :bucket_prefix  => 'bp',
                :old_secret     => 'oldpassword',
                :new_secret     => 'newpassword',
                :aws_access_key => 'key',
                :aws_secret_key => 'secret' }
    Trollop.stub(:options).and_return options

    catalog_stub = stub :regions => ['us-east-1', 'us-west-1']
    Heirloom::Catalog.stub(:new).and_return catalog_stub

    @archive_mock = mock 'archive'
    @logger_mock = mock_log
    Heirloom::HeirloomLogger.stub :new => @logger_mock
    Heirloom::Archive.stub(:new).and_return @archive_mock

  end

  it "should delegate to archive object" do

    @archive_mock.should_receive :rotate

    Heirloom::CLI::Rotate.new.rotate

  end

  it "should log and do a SystemExit when a rotate fails" do
    
    @archive_mock.stub(:rotate).and_raise Heirloom::Exceptions::RotateFailed.new("failed")

    @logger_mock.should_receive(:error).with "failed"
    expect {
      Heirloom::CLI::Rotate.new.rotate
    }.to raise_error SystemExit
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heirloom-0.12.1 spec/cli/rotate_spec.rb
heirloom-0.12.0 spec/cli/rotate_spec.rb