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

@ -15,26 +15,26 @@ describe "Enumerable#one?" do
end
it "raises an ArgumentError when more than 1 argument is provided" do
lambda { @enum.one?(1, 2, 3) }.should raise_error(ArgumentError)
lambda { [].one?(1, 2, 3) }.should raise_error(ArgumentError)
lambda { {}.one?(1, 2, 3) }.should raise_error(ArgumentError)
-> { @enum.one?(1, 2, 3) }.should raise_error(ArgumentError)
-> { [].one?(1, 2, 3) }.should raise_error(ArgumentError)
-> { {}.one?(1, 2, 3) }.should raise_error(ArgumentError)
end
ruby_version_is ""..."2.5" do
it "raises an ArgumentError when any arguments provided" do
lambda { @enum.one?(Proc.new {}) }.should raise_error(ArgumentError)
lambda { @enum.one?(nil) }.should raise_error(ArgumentError)
lambda { @empty.one?(1) }.should raise_error(ArgumentError)
lambda { @enum.one?(1) {} }.should raise_error(ArgumentError)
-> { @enum.one?(Proc.new {}) }.should raise_error(ArgumentError)
-> { @enum.one?(nil) }.should raise_error(ArgumentError)
-> { @empty.one?(1) }.should raise_error(ArgumentError)
-> { @enum.one?(1) {} }.should raise_error(ArgumentError)
end
end
it "does not hide exceptions out of #each" do
lambda {
-> {
EnumerableSpecs::ThrowingEach.new.one?
}.should raise_error(RuntimeError)
lambda {
-> {
EnumerableSpecs::ThrowingEach.new.one? { false }
}.should raise_error(RuntimeError)
end
@ -72,7 +72,7 @@ describe "Enumerable#one?" do
end
it "does not hide exceptions out of the block" do
lambda {
-> {
@enum.one? { raise "from block" }
}.should raise_error(RuntimeError)
end
@ -117,7 +117,7 @@ describe "Enumerable#one?" do
end
it "does not hide exceptions out of #each" do
lambda {
-> {
EnumerableSpecs::ThrowingEach.new.one?(Integer)
}.should raise_error(RuntimeError)
end
@ -153,7 +153,7 @@ describe "Enumerable#one?" do
it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
lambda {
-> {
@enum.one?(pattern)
}.should raise_error(RuntimeError)
end