Sha256: 98eaa3b52a6d356b9334942a0ccef02ae6a1fa02b2c4c134cb13d8dfc7e7109b

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do
    @catalog = { 'test1' =>
                   { 'regions'       => ['us-west-1', 'us-east-1'],
                     'bucket_prefix' => ['bp1'] },
                 'test2' => 
                   { 'regions'       => ['us-west-2'],
                     'bucket_prefix' => ['bp2'] }
               } 
    @formatter = Heirloom::CLI::Formatter::Catalog.new
  end

  context "unfiltered" do
    it "should return the formated list" do
      @formatter.format(:catalog => @catalog,
                        :details => nil,
                        :name    => nil ).should == "test1\ntest2"
    end
  end

  context "filtered" do
    it "should return the name with details" do
      format = "test1\n  Regions       : us-west-1, us-east-1\n  Bucket Prefix : bp1"
      @formatter.format(:catalog => @catalog,
                        :name    => 'test1').should == format
    end

    it "should return not found if name does not exist in catalog" do
      format = "Heirloom not_here not found in catalog."
      @formatter.format(:catalog => @catalog,
                        :name    => 'not_here').should == format
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
heirloom-0.10.1 spec/cli/formatter/catalog_spec.rb
heirloom-0.10.0 spec/cli/formatter/catalog_spec.rb
heirloom-0.9.0 spec/cli/formatter/catalog_spec.rb
heirloom-0.8.3 spec/cli/formatter/catalog_spec.rb
heirloom-0.8.2 spec/cli/formatter/catalog_spec.rb
heirloom-0.8.1 spec/cli/formatter/catalog_spec.rb
heirloom-0.8.0 spec/cli/formatter/catalog_spec.rb