spec/ext/func_spec.rb in therubyracer-0.7.0 vs spec/ext/func_spec.rb in therubyracer-0.7.1.pre
- old
+ new
@@ -4,41 +4,41 @@
describe C::Function do
it "is callable" do
Context.new do |cxt|
f = cxt.eval('(function() {return "Hello World"})', '<eval>');
- f.call(nil).should == "Hello World"
+ f.call().should == "Hello World"
end
end
it "receives proper argument length from ruby" do
Context.new do |cxt|
f = cxt.eval('(function() {return arguments.length})', 'eval')
- f.call(nil,1, 2, 3).should == 3
+ f.call(1, 2, 3).should == 3
end
end
it "maps all arguments from ruby" do
Context.new do |cxt|
f = cxt.eval('(function(one, two, three) {return one + two + three})', 'eval')
- f.call(nil, 1,2,3).should == 6
+ f.call(1,2,3).should == 6
end
end
it "properly maps ruby objects back and forth from arguments to return value" do
Context.new do |cxt|
Object.new.tap do |this|
f = cxt.eval('(function() {return this})', 'eval')
- f.call(this).should be(this)
+ f.methodcall(this).should be(this)
end
end
end
it "can be called outside of a context" do
Context.new do |cxt|
@f = cxt.eval('(function() {return "Call Me"})', 'eval')
end
- @f.call(nil).should == "Call Me"
+ @f.call().should == "Call Me"
end
it "is reflected properly" do
Context.new do |cxt|
cxt['say'] = lambda {|word, times| word * times}
\ No newline at end of file