2010-01-14 00:51:46 +02:00
|
|
|
|
|
|
|
require "#{File.dirname(__FILE__)}/../spec_helper.rb"
|
|
|
|
|
|
|
|
include V8
|
|
|
|
|
|
|
|
describe C::Context do
|
|
|
|
|
|
|
|
it "should not have a current context if no context is open" do
|
2010-05-17 15:14:36 +03:00
|
|
|
C::Context::GetEntered().should be_nil
|
2010-01-14 00:51:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "can determine if there is a current context" do
|
|
|
|
C::Context::InContext().should be(false)
|
|
|
|
C::Context.new.open do |cxt|
|
|
|
|
C::Context::InContext().should be(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns the currently open context" do
|
|
|
|
C::Context.new.open do |cxt|
|
2010-05-17 15:13:23 +03:00
|
|
|
cxt.should be_eql(C::Context::GetEntered())
|
|
|
|
cxt.should == C::Context::GetEntered()
|
2010-01-14 00:51:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|