Sha256: f8e4741aebe5c0b4ef7e2da41ee3bc04bfd18d4fbad2e449bc17dca13df3f15f

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 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', 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

3 entries across 3 versions & 1 rubygems

Version Path
mulder-0.0.3 spec/lib/mulder/instance_spec.rb
mulder-0.0.2 spec/lib/mulder/instance_spec.rb
mulder-0.0.1 spec/lib/mulder/instance_spec.rb