Sha256: 06f896c1860fb8ddd1a5ad364d025d846f0bea300d662bd3191b4b0e9e40d28b

Contents?: true

Size: 896 Bytes

Versions: 10

Compression:

Stored size: 896 Bytes

Contents

require 'spec_helper'

describe Outliers::Filters::Aws::Ec2::Tags do
  subject do
    object = Object.new
    object.extend Outliers::Filters::Aws::Ec2::Tags
    object
  end

  let(:logger) { stub 'logger', debug: true, info: true }
  let(:tags1) { mock 'tags1' }
  let(:tags2) { mock 'tags2' }
  let(:resource1) { stub 'resource1', tags: tags1, id: 'resource1' }
  let(:resource2) { stub 'resource2', tags: tags2, id: 'resource2' }

  before do
    subject.stub :logger => logger
    subject.stub :list => [resource1, resource2]
  end

  it "should return the list of instances filtered by the given tag name and value" do
    tags1.should_receive(:has_key?).with('Name').and_return true
    tags2.should_receive(:has_key?).with('Name').and_return false
    tags1.should_receive(:[]).with('Name').and_return 'test123'
    expect(subject.filter_tag('Name:test123')).to eq([resource1])
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
outliers-0.6.0 spec/filters/aws/ec2/tags_spec.rb
outliers-0.5.1 spec/filters/aws/ec2/tags_spec.rb
outliers-0.5.0 spec/filters/aws/ec2/tags_spec.rb
outliers-0.5.0.beta3 spec/filters/aws/ec2/tags_spec.rb
outliers-0.5.0.beta2 spec/filters/aws/ec2/tags_spec.rb
outliers-0.5.0.beta1 spec/filters/aws/ec2/tags_spec.rb
outliers-0.3.3 spec/filters/aws/ec2/tags_spec.rb
outliers-0.3.2 spec/filters/aws/ec2/tags_spec.rb
outliers-0.3.1 spec/filters/aws/ec2/tags_spec.rb
outliers-0.3.0 spec/filters/aws/ec2/tags_spec.rb