Sha256: f13427f2d430fee345c3c13ef971f36ff4aa55c4fa8cd0420be6ebac0fe00487

Contents?: true

Size: 600 Bytes

Versions: 27

Compression:

Stored size: 600 Bytes

Contents

require 'spec_helper'
require 'fog/core/current_machine'

describe Fog::CurrentMachine do
  context '#ip_address' do
    before(:each){ described_class.ip_address = nil }

    it 'should be threadsafe' do
      Net::HTTP.should_receive(:get_response).once{ Struct.new(:body).new('') }

      (1..10).map {
        Thread.new { described_class.ip_address }
      }.each{ |t| t.join }
    end

    it 'should remove trailing endline characters' do
      Net::HTTP.stub(:get_response){ Struct.new(:body).new("192.168.0.1\n") }

      described_class.ip_address.should == '192.168.0.1'
    end
  end
end

Version data entries

27 entries across 27 versions & 7 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
michiels-fog-1.3.1 spec/core/current_machine_spec.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/spec/core/current_machine_spec.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
fog-1.3.1 spec/core/current_machine_spec.rb
fog-1.3.0 spec/core/current_machine_spec.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
fog-1.2.0 spec/core/current_machine_spec.rb
ktheory-fog-1.1.2 spec/core/current_machine_spec.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
fog-1.1.2 spec/core/current_machine_spec.rb
fog_tractical-1.1.4 spec/core/current_machine_spec.rb
fog_tractical-1.1.3 spec/core/current_machine_spec.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/spec/core/current_machine_spec.rb
fog-1.1.1 spec/core/current_machine_spec.rb
fog-1.1.0 spec/core/current_machine_spec.rb