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:
parent
b28e687485
commit
11d294da4c
1 changed files with 9 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue