Sha256: 89676b9090c5b415663871ef2256751c235197e5b81691b4fb5c192806de022b

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Mulder::Instance do

  let(:attributes) { { id: "i-f17bf19e", dns_name: 'foo.example.org', public_ip_address: '10.0.0.2', private_ip_address: '10.1.1.1', availability_zone: 'us-east-1a', vpc_id: 'vpc-e9663d87', created_at: DateTime.parse('2013-09-10 19:39:26 UTC').to_s } }

  describe '.new' do
    it 'stores the fog computer instance' do
      fog_compute_instance = mock
      described_class.new(fog_compute_instance).fog_compute_instance.should == fog_compute_instance
    end
  end

  describe '#as_hash' do
    let(:instance) { mock(attributes) }

    it 'has the expected attributes' do
      described_class.new(instance).as_hash.should == attributes
    end

    it 'rejects blank values' do
      instance = mock(attributes.merge(id: ''))
      described_class.new(instance).as_hash.should ==
        attributes.reject { |key, _| key == :id }
    end

    it 'rejects nil values' do
      instance = mock(attributes.merge(id: nil))
      described_class.new(instance).as_hash.should ==
        attributes.reject { |key, _| key == :id }
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mulder-0.3.2 spec/lib/mulder/instance_spec.rb
mulder-0.3.1 spec/lib/mulder/instance_spec.rb
mulder-0.3.0 spec/lib/mulder/instance_spec.rb
mulder-0.2.1 spec/lib/mulder/instance_spec.rb
mulder-0.2.0 spec/lib/mulder/instance_spec.rb
mulder-0.1.0 spec/lib/mulder/instance_spec.rb
mulder-0.0.5 spec/lib/mulder/instance_spec.rb
mulder-0.0.4 spec/lib/mulder/instance_spec.rb