Created
May 23, 2009 00:12
-
-
Save jarib/116433 to your computer and use it in GitHub Desktop.
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
commit f4aa1e3dcc02f946489a2ce83618a82a42f2a1b6 | |
Author: Jari Bakken <[email protected]> | |
Date: Sat May 23 02:02:16 2009 +0200 | |
Check that Method#call works for methods defined with attr_accessor | |
diff --git a/core/method/shared/call.rb b/core/method/shared/call.rb | |
index 0f6451b..a5a45c6 100644 | |
--- a/core/method/shared/call.rb | |
+++ b/core/method/shared/call.rb | |
@@ -3,6 +3,9 @@ describe :method_call, :shared => true do | |
m = 12.method("+") | |
m.send(@method, 3).should == 15 | |
m.send(@method, 20).should == 32 | |
+ | |
+ m = MethodSpecs::Methods.new.method(:attr=) | |
+ m.send(@method, 42).should == 42 | |
end | |
it "raises an ArgumentError when given incorrect number of arguments" do | |
commit 999fa5090bdc8d120453d2fcb6b963e0b50f44ae | |
Author: Jari Bakken <[email protected]> | |
Date: Sat May 23 01:39:33 2009 +0200 | |
Add spec for Method#arity when defined through attr_accessor | |
diff --git a/core/method/arity_spec.rb b/core/method/arity_spec.rb | |
index 758c75c..24f07ba 100644 | |
--- a/core/method/arity_spec.rb | |
+++ b/core/method/arity_spec.rb | |
@@ -8,7 +8,9 @@ describe "Method#arity" do | |
it "returns n, where n is the number of required arguments, when there are zero or more required arguments only" do | |
@m.method(:zero).arity.should == 0 | |
+ @m.method(:attr).arity.should == 0 | |
@m.method(:one_req).arity.should == 1 | |
+ @m.method(:attr=).arity.should == 1 | |
@m.method(:two_req).arity.should == 2 | |
end | |
diff --git a/core/method/fixtures/classes.rb b/core/method/fixtures/classes.rb | |
index 5b78bb7..87d4f1d 100644 | |
--- a/core/method/fixtures/classes.rb | |
+++ b/core/method/fixtures/classes.rb | |
@@ -5,6 +5,8 @@ module MethodSpecs | |
end | |
alias bar foo | |
+ attr_accessor :attr | |
+ | |
def zero; end | |
def one_req(a); end | |
def two_req(a, b); end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment