Sha256: 109815f2116d9dc59ca213c76a252a95fb55ef8be02df9be8f97016cf75ec71c
Contents?: true
Size: 1.19 KB
Versions: 16
Compression:
Stored size: 1.19 KB
Contents
require File.expand_path("../../test_helper", __FILE__) class GlobalTest < Test::Unit::TestCase setup do @klass = VirtualBox::Global end context "getting the global object" do setup do @lib = mock('lib') VirtualBox::Lib.stubs(:lib).returns(@lib) @klass.reset! end should "initialize the object with the lib once" do instance = mock("instance") @klass.expects(:new).with(@lib).once.returns(instance) assert_equal instance, @klass.global assert_equal instance, @klass.global assert_equal instance, @klass.global end should "initialize the object if reload is set" do instance = mock("instance") @klass.expects(:new).with(@lib).twice.returns(instance) assert_equal instance, @klass.global assert_equal instance, @klass.global(true) assert_equal instance, @klass.global end end context "with an instance" do setup do @lib = mock("lib") @instance = @klass.new(@lib) end should "be an existing record, always" do assert !@instance.new_record? end should "setup the lib attribute on initialization" do assert_equal @lib, @instance.lib end end end
Version data entries
16 entries across 16 versions & 3 rubygems