1
0
Fork 0
mirror of https://github.com/rubyjs/therubyrhino synced 2023-03-27 23:21:34 -04:00

Added spec for scoping an evaluation to a ruby object.

This commit is contained in:
Alex Wolfe 2011-09-21 17:07:34 -05:00
parent b28e687485
commit 11d294da4c

View file

@ -25,6 +25,15 @@ describe Rhino::Context do
end end
end end
it "allows you to scope the context to an object" do
class MyScope
def foo; proc { 'bar' }; end
end
Context.open(:with => MyScope.new) do |ctx|
ctx.eval("foo()").should == 'bar'
end
end
it "allows you to seal the standard objects so that they cannot be modified" do it "allows you to seal the standard objects so that they cannot be modified" do
Context.open(:sealed => true) do |cxt| Context.open(:sealed => true) do |cxt|
lambda { lambda {