spec/ext/func_spec.rb in therubyracer-0.8.2.pre vs spec/ext/func_spec.rb in therubyracer-0.8.2.pre2
- old
+ new
@@ -44,6 +44,21 @@
Context.new do |cxt|
cxt['say'] = lambda {|word, times| word * times}
cxt.eval('say("Hello", 3)').should == "HelloHelloHello"
end
end
+
+ it "has a name" do
+ Context.new do |cxt|
+ f = cxt.eval('(function hi() {return "Hello World"})', '<eval>')
+ f.name.should == "hi"
+ end
+ end
+
+ it "can have its name set" do
+ Context.new do |cxt|
+ f = cxt.eval('(function () {return "Goodbye World"})', '<eval>')
+ f.name = 'bye'
+ f.name.should == 'bye'
+ end
+ end
end
\ No newline at end of file