Sha256: 8bab23836a379d3f962750d3e56e4a8b20dacd3c9a3c52a3c886034383da34c7
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe "Tomato bound methods" do subject { Tomato.new } it "should map Ruby methods to JavaScript methods" do subject.bind_method(:inspect).should == true proc { subject.run("(inspect());") }.should_not raise_error end it "should map Ruby methods to JS on a specific object within JS" do subject.bind_method(:inspect, "hello", :to => "greeting") subject.run("greeting.inspect();").should == '"hello"' end it "should map Ruby methods to JS on an object chain within JS" do subject.bind_method(:inspect, "hello", :to => "greeting.first") subject.run("greeting.first.inspect();").should == '"hello"' end it "should map Ruby methods to Javascript on a specific object without a hash" do subject.bind_method(:inspect, "hello").should == true subject.run("(inspect());").should == '"hello"' end it "should map Ruby methods to Javascript on a specific object with a hash" do subject.bind_method(:inspect, :object => "hello").should == true subject.run("(inspect());").should == '"hello"' end it "should accept arguments" do subject.bind_method(:echo) def subject.echo(i); i; end subject.run("echo(1);").should == 1 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tomato-0.0.1.prealpha2 | spec/lib/bound_methods_spec.rb |