Skip to content

Commit

Permalink
RubySpec: add a spec for multi-targets super.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Feb 10, 2015
1 parent 59122d2 commit a56a80a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/ruby/language/fixtures/super.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,34 @@ def baz(a)
end
end

module MultiSuperTargets
module M
def foo
super
end
end

class BaseA
def foo
:BaseA
end
end

class BaseB
def foo
:BaseB
end
end

class A < BaseA
include M
end

class B < BaseB
include M
end
end

module MS3
module ModA
def foo(a)
Expand Down
5 changes: 5 additions & 0 deletions spec/ruby/language/super_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
Super::MS2::C.new.foo([]).should == ["ModB#foo","C#baz","A#baz"]
end

it "can resolve to different methods in an included module method" do
Super::MultiSuperTargets::A.new.foo.should == :BaseA
Super::MultiSuperTargets::B.new.foo.should == :BaseB
end

it "searches class methods including modules" do
Super::MS3::A.new.foo([]).should == ["A#foo"]
Super::MS3::A.foo([]).should == ["ModA#foo"]
Expand Down

0 comments on commit a56a80a

Please sign in to comment.