Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Spec for alias+super interaction with included modules

  • Loading branch information...
commit 44fa18d59e08b00e5b44e8fe21ff42534856bc73 1 parent ed37e2d
Evan Phoenix authored
View
31 spec/ruby/language/fixtures/super.rb
@@ -259,4 +259,35 @@ class Alias3 < Alias2
# Otherwise, Alias2 is next, which is where name was to begin with,
# causing the wrong #name method to be called.
end
+
+ module AliasWithSuper
+ module AS1
+ def foo
+ :a
+ end
+ end
+
+ module BS1
+ def foo
+ [:b, super]
+ end
+ end
+
+ class Base
+ extend AS1
+ extend BS1
+ end
+
+ class Trigger < Base
+ class << self
+ def foo_quux
+ foo_baz
+ end
+
+ alias_method :foo_baz, :foo
+ alias_method :foo, :foo_quux
+ end
+ end
+ end
+
end
View
6 spec/ruby/language/super_spec.rb
@@ -142,4 +142,10 @@ def a; "a"; end
Super::Alias3.new.name3.should == [:alias2, :alias1]
}.should_not raise_error(RuntimeError)
end
+
+ it "sees the included version of a module a method is alias from" do
+ lambda {
+ Super::AliasWithSuper::Trigger.foo.should == [:b, :a]
+ }.should_not raise_error(NoMethodError)
+ end
end

0 comments on commit 44fa18d

Please sign in to comment.
Something went wrong with that request. Please try again.