Sha256: 61c74293a3e7a354a390d9c0513bad7ff3c67545defcb55be3403b99021eeefc

Contents?: true

Size: 1.73 KB

Versions: 24

Compression:

Stored size: 1.73 KB

Contents

require 'test/unit'
require 'veewee/provider/virtualbox/box/helper/version'
require 'logger'

class TestVboxGuestAdditionsHelper < Test::Unit::TestCase
  include Veewee::Provider::Virtualbox::BoxCommand

  def affected_versions
    {
      "4.2.1" => "4.2.0",
      "4.1.23" => "4.1.22"
    }
  end

  def test_affected_osx_version_returns_downpatched_ga_version
    set_ruby_platform("darwin")
    affected_versions.each do |vbox_version, guest_version|
      set_vbox_version(vbox_version)
      assert_equal(guest_version, self.vboxga_version)
    end
  end

  def test_unaffected_osx_version_returns_same_version
    set_ruby_platform("darwin")
    set_vbox_version("4.1.22")
    assert_equal("4.1.22", self.vboxga_version)
  end

  def test_affected_linux_version_returns_same_version
    set_ruby_platform("linux")
    affected_versions.keys.each do |version|
      set_vbox_version(version)
      assert_equal(version, self.vboxga_version)
    end
  end

  def test_unaffected_linux_version_returns_same_version
    set_ruby_platform("linux")
    set_vbox_version("4.0.19")
    assert_equal("4.0.19", self.vboxga_version)
  end

  def test_affected_mswin_version_returns_same_version
    set_ruby_platform("mswin")
    affected_versions.keys.each do |version|
      set_vbox_version(version)
      assert_equal(version, self.vboxga_version)
    end
  end

  def test_unaffected_mswin_version_returns_same_version
    set_ruby_platform("mswin")
    set_vbox_version("4.0.19")
    assert_equal("4.0.19", self.vboxga_version)
  end

private
  def set_ruby_platform(platform)
    Object.const_set("RUBY_PLATFORM", platform)
  end

  def set_vbox_version(ver)
    Veewee::Provider::Virtualbox::BoxCommand.send(:define_method, :vbox_version) do
      ver
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
veewee-0.5.0.alpha4 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.5.0.alpha3 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.5.0.alpha2 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.5.0.alpha1 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.5.1 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.5 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.5.pre1 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.4 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.3 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.2 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.1 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.4.0 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.12 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.11 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.10 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.9 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-atlassian-0.3.11 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.7 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.6 test/veewee/provider/virtualbox/box/helper/version.rb
veewee-0.3.5 test/veewee/provider/virtualbox/box/helper/version.rb