-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow super to be called in singleton object method (fixes #335)
- Loading branch information
1 parent
20d3593
commit 8c43aa4
Showing
3 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
require 'spec_helper' | ||
|
||
class SingletonMethodSuperSpec | ||
def meth | ||
"bar" | ||
end | ||
end | ||
|
||
# FIXME: we cant make a better test case than this??? For some reason, a single test cannot be deduced | ||
describe "The 'super' keyword" do | ||
it "passes the right arguments when a variable rewrites special `arguments` js object" do | ||
Struct.new(:a, :b, :c).new(1, 2, 3).b.should == 2 | ||
end | ||
|
||
it "calls super method on object that defines singleton method calling super" do | ||
obj = SingletonMethodSuperSpec.new | ||
def obj.meth; "foo " + super; end | ||
obj.meth.should == "foo bar" | ||
end | ||
end |