Sha256: 7ef015128eb63db1e27b1f149e8965dbf3123d090ffb785d4074c9b4732d5b09
Contents?: true
Size: 734 Bytes
Versions: 22
Compression:
Stored size: 734 Bytes
Contents
%x{ var BridgeClassProto = function() { this.foo = 200; }; BridgeClassProto.prototype = { bar: 300, baz: 400 }; } class BridgeClassSpec < `BridgeClassProto` def get_foo `#{self}.foo` end def say_it "hello world" end end describe "Bridging native prototypes to a class" do it "should have a superclass of Object" do BridgeClassSpec.superclass.should == Object end it "should report instances as kind of bridged class" do obj = `new BridgeClassProto()` obj.class.should == BridgeClassSpec end it "should have defined instance methods present on prototype" do obj = `new BridgeClassProto()` obj.get_foo.should == 200 obj.say_it.should == "hello world" end end
Version data entries
22 entries across 22 versions & 1 rubygems