Sha256: 7e27184995b414a264b8b083d273cb9db2cbc3b6395c2d2c38414973cf009a71

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do
    options = { :name  => 'archive_name',
                :level => 'info',
                :count => 100 }
    @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::List.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
    @archive_mock.should_receive(:count)
    @cli_list = Heirloom::CLI::List.new
  end

  it "should list ids for given archive" do
    @archive_mock.should_receive(:list).with(100).and_return(['1','2'])
    @cli_list.should_receive(:jj).with ['1','2']
    @cli_list.list
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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