1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -57,7 +57,7 @@ describe "Array#sample" do
end
it "raises ArgumentError when passed a negative count" do
lambda { [1, 2].sample(-1) }.should raise_error(ArgumentError)
-> { [1, 2].sample(-1) }.should raise_error(ArgumentError)
end
it "does not return subclass instances with Array subclass" do
@ -92,7 +92,7 @@ describe "Array#sample" do
it "raises a NoMethodError if an object passed for the RNG does not define #rand" do
obj = BasicObject.new
lambda { [1, 2].sample(random: obj) }.should raise_error(NoMethodError)
-> { [1, 2].sample(random: obj) }.should raise_error(NoMethodError)
end
describe "when the object returned by #rand is a Fixnum" do
@ -112,14 +112,14 @@ describe "Array#sample" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(-1)
lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
-> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is equal to the Array size" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(2)
lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
-> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
end
end
@ -140,7 +140,7 @@ describe "Array#sample" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(value)
lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
-> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is equal to the Array size" do
@ -149,7 +149,7 @@ describe "Array#sample" do
random = mock("array_sample_random")
random.should_receive(:rand).and_return(value)
lambda { [1, 2].sample(random: random) }.should raise_error(RangeError)
-> { [1, 2].sample(random: random) }.should raise_error(RangeError)
end
end
end