aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/method/parameters_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/method/parameters_spec.rb')
-rw-r--r--spec/ruby/core/method/parameters_spec.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/ruby/core/method/parameters_spec.rb b/spec/ruby/core/method/parameters_spec.rb
index 750abe13d0..1de3901040 100644
--- a/spec/ruby/core/method/parameters_spec.rb
+++ b/spec/ruby/core/method/parameters_spec.rb
@@ -243,17 +243,19 @@ describe "Method#parameters" do
end
it "returns [[:rest]] for core methods with variable-length argument lists" do
- m = "foo"
-
- # match takes rest args
- m.method(:match).parameters.should == [[:rest]]
+ # delete! takes rest args
+ "foo".method(:delete!).parameters.should == [[:rest]]
+ end
- # [] takes 1 to 3 args
- m.method(:[]).parameters.should == [[:rest]]
+ it "returns [[:rest]] or [[:opt]] for core methods with optional arguments" do
+ # pop takes 1 optional argument
+ [
+ [[:rest]],
+ [[:opt]]
+ ].should include([].method(:pop).parameters)
end
it "returns [[:req]] for each parameter for core methods with fixed-length argument lists" do
- m = "foo"
- m.method(:+).parameters.should == [[:req]]
+ "foo".method(:+).parameters.should == [[:req]]
end
end