Sha256: d6eea8040666b2df345e23337eefb02474deb19a71f849dec73d3c5398cdb698

Contents?: true

Size: 1.82 KB

Versions: 43

Compression:

Stored size: 1.82 KB

Contents

Shindo.tests('Fog mocking', 'core') do
  before do
    @fog_was_mocked = Fog.mock?
    Fog.unmock! if @fog_was_mocked
  end

  after do
    Fog.mock! if @fog_was_mocked
  end

  tests('Fog.mock!') do
    tests('Fog.mock!').returns(true) do
      Fog.mock!
    end

    tests('Fog.mock? without Fog.mock!').returns(false) do
      Fog.mock?
    end

    tests('Fog.mock? with Fog.mock!').returns(true) do
      Fog.mock!
      Fog.mock?
    end

    tests('Fog.mocking? without Fog.mock!').returns(false) do
      Fog.mocking?
    end

    tests('Fog.mocking? with Fog.mock!').returns(true) do
      Fog.mock!
      Fog.mocking?
    end
  end

  tests('Fog::Mock.delay') do
    tests('Fog::Mock.delay').returns(1, "defaults to 1") do
      Fog::Mock.delay
    end

    tests('Fog::Mock.delay = 2').returns(2, "changes Fog::Mock.delay to 2") do
      Fog::Mock.delay = 2
      Fog::Mock.delay
    end

    tests('Fog::Mock.delay = 0').returns(0, "changes Fog::Mock.delay to 0") do
      Fog::Mock.delay = 0
      Fog::Mock.delay
    end

    tests('Fog::Mock.delay = -1').raises(ArgumentError) do
      Fog::Mock.delay = -1
    end
  end

  tests('Fog::Mock.random_ip') do
    tests('Fog::Mock.random_ip').returns(true, "default to ipv4") do
      IPAddr.new(Fog::Mock.random_ip).ipv4?
    end
    tests('Fog::Mock.random_ip').returns(true, "explicit ipv4") do
      IPAddr.new(Fog::Mock.random_ip({:version => :v4})).ipv4?
    end
    tests('Fog::Mock.random_ip({:version => :v6})').returns(true, "changes to ipv6") do
      IPAddr.new(Fog::Mock.random_ip({:version => :v6})).ipv6?
    end
    tests('Fog::Mock.random_ip({:version => :v5})').raises(ArgumentError) do
      IPAddr.new(Fog::Mock.random_ip({:version => :v5})).ipv4?
    end
  end

  tests('Fog::Mock.not_implemented').raises(Fog::Errors::MockNotImplemented) do
    Fog::Mock.not_implemented
  end


end

Version data entries

43 entries across 41 versions & 6 rubygems

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