Skip to content

Commit 650961b

Browse files
committed
Improve Method#parameters spec
1 parent 46efcc2 commit 650961b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

spec/ruby/core/method/parameters_spec.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,16 @@ def one_splat_one_block(*args, &block)
243243
end
244244

245245
it "returns [[:rest]] for core methods with variable-length argument lists" do
246-
m = "foo"
247-
248-
# match takes rest args
249-
m.method(:match).parameters.should == [[:rest]]
246+
# delete! takes rest args
247+
"foo".method(:delete!).parameters.should == [[:rest]]
248+
end
250249

251-
# [] takes 1 to 3 args
252-
m.method(:[]).parameters.should == [[:rest]]
250+
it "returns [[:rest]] for core methods with optional arguments" do
251+
# pop takes 1 optional argument
252+
[].method(:pop).parameters.should == [[:rest]]
253253
end
254254

255255
it "returns [[:req]] for each parameter for core methods with fixed-length argument lists" do
256-
m = "foo"
257-
m.method(:+).parameters.should == [[:req]]
256+
"foo".method(:+).parameters.should == [[:req]]
258257
end
259258
end

0 commit comments

Comments
 (0)