Sha256: 57c331a2a5a4ce7356837b05f146d4816ef39ce189e9051c68aaf5673c4ccfca

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do
    options = { :name  => 'archive_name',
                :id    => '1.0.0',
                :level => 'info' }
    @logger_stub = stub :debug => true
    @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_stub
    Heirloom::CLI::Show.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',
                           :id     => '1.0.0',
                           :config => @config_mock).
                      and_return @archive_mock
    @cli_show = Heirloom::CLI::Show.new
  end

  it "should show a given id" do
    @archive_mock.should_receive(:show).and_return( { 'id' => '1.0.0' } )
    @cli_show.should_receive(:jj).with 'id' => '1.0.0'
    @cli_show.show
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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