Sha256: b821d5065f52be2675c4052a106ebcb3e0e258e577cd5e20dd1c0b821eafa842

Contents?: true

Size: 782 Bytes

Versions: 119

Compression:

Stored size: 782 Bytes

Contents

Shindo.tests('Fog CurrentMachine', 'core') do

  pending unless Fog.mock?

  old_excon_defaults_mock = Excon.defaults[:mock]
  Excon.defaults[:mock] = true

  tests('ip_address') do

    tests('should be thread safe') do
      Excon.stub({:method => :get, :path => '/'}, {:body => ''})

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

    Fog::CurrentMachine.ip_address = nil
    Excon.stubs.clear

    tests('should remove trailing endline characters') do
      Excon.stub({:method => :get,  :path => '/'}, {:body => "192.168.0.1\n"})
      Fog::CurrentMachine.ip_address == '192.168.0.1'
    end

  end

  Fog::CurrentMachine.ip_address = nil
  Excon.stubs.clear
  Excon.defaults[:mock] = old_excon_defaults_mock

end

Version data entries

119 entries across 117 versions & 15 rubygems

Version Path
fog-2.3.0 tests/core/current_machine_tests.rb
fog-ifeel-2.2.0 tests/core/current_machine_tests.rb
fog-2.2.0 tests/core/current_machine_tests.rb
fog-2.1.0 tests/core/current_machine_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/tests/core/current_machine_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/tests/core/current_machine_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/tests/core/current_machine_tests.rb
fog-1.42.1 tests/core/current_machine_tests.rb
fog-2.0.0 tests/core/current_machine_tests.rb
fog-1.42.0 tests/core/current_machine_tests.rb
fog-1.41.0 tests/core/current_machine_tests.rb
fog-1.40.0 tests/core/current_machine_tests.rb
fog-1.39.0 tests/core/current_machine_tests.rb
fog-1.38.0 tests/core/current_machine_tests.rb
fog-1.37.0 tests/core/current_machine_tests.rb
fog-1.36.0 tests/core/current_machine_tests.rb
fog-1.35.0 tests/core/current_machine_tests.rb
fog-2.0.0.pre.0 tests/core/current_machine_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/core/current_machine_tests.rb
fog-1.34.0 tests/core/current_machine_tests.rb