mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue