Sha256: 31d3025277a501990d7fe7f5866a53fc0b67b0a298880f54e8caf46c372dbaef
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
require File.expand_path('../../spec_helper', __FILE__) require File.expand_path('../fixtures/super', __FILE__) describe "The super keyword" do it "calls the method on the calling class" do Super::S1::A.new.foo([]).should == ["A#foo", "A#bar"] Super::S1::A.new.bar([]).should == ["A#bar"] Super::S1::B.new.foo([]).should == ["B#foo","A#foo","B#bar","A#bar"] Super::S1::B.new.bar([]).should == ["B#bar", "A#bar"] end it "searches the full inheritence chain" do Super::S2::B.new.foo([]).should == ["B#foo", "A#baz"] Super::S2::B.new.baz([]).should == ["A#baz"] Super::S2::C.new.foo([]).should == ["B#foo","C#baz","A#baz"] Super::S2::C.new.baz([]).should == ["C#baz","A#baz"] end it "searches class methods" do Super::S3::A.new.foo([]).should == ["A#foo"] Super::S3::A.foo([]).should == ["A::foo"] Super::S3::A.bar([]).should == ["A::bar","A::foo"] Super::S3::B.new.foo([]).should == ["A#foo"] Super::S3::B.foo([]).should == ["B::foo","A::foo"] Super::S3::B.bar([]).should == ["B::bar","A::bar","B::foo","A::foo"] end it "calls the method on the calling class including modules" do Super::MS1::A.new.foo([]).should == ["ModA#foo", "ModA#bar"] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-0.3.2 | gems/core/spec/language/super_spec.rb |
opal-0.3.1 | gems/core/spec/language/super_spec.rb |
opal-0.3.0 | gems/core/spec/language/super_spec.rb |