summaryrefslogtreecommitdiff
path: root/spec/ruby/core/enumerable/shared
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
commit5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch)
tree05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/enumerable/shared
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/enumerable/shared')
-rw-r--r--spec/ruby/core/enumerable/shared/collect_concat.rb2
-rw-r--r--spec/ruby/core/enumerable/shared/find.rb10
-rw-r--r--spec/ruby/core/enumerable/shared/take.rb8
3 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/core/enumerable/shared/collect_concat.rb b/spec/ruby/core/enumerable/shared/collect_concat.rb
index c081c1be71..ddd431baeb 100644
--- a/spec/ruby/core/enumerable/shared/collect_concat.rb
+++ b/spec/ruby/core/enumerable/shared/collect_concat.rb
@@ -41,7 +41,7 @@ describe :enumerable_collect_concat, shared: true do
obj = mock("to_ary defined")
obj.should_receive(:to_ary).and_return("array")
- lambda { [1, obj, 3].send(@method) { |i| i } }.should raise_error(TypeError)
+ -> { [1, obj, 3].send(@method) { |i| i } }.should raise_error(TypeError)
end
it "returns an enumerator when no block given" do
diff --git a/spec/ruby/core/enumerable/shared/find.rb b/spec/ruby/core/enumerable/shared/find.rb
index 3435ce3658..61d63ba3d5 100644
--- a/spec/ruby/core/enumerable/shared/find.rb
+++ b/spec/ruby/core/enumerable/shared/find.rb
@@ -29,23 +29,23 @@ describe :enumerable_find, shared: true do
end
it "returns the value of the ifnone proc if the block is false" do
- fail_proc = lambda { "cheeseburgers" }
+ fail_proc = -> { "cheeseburgers" }
@numerous.send(@method, fail_proc) {|e| false }.should == "cheeseburgers"
end
it "doesn't call the ifnone proc if an element is found" do
- fail_proc = lambda { raise "This shouldn't have been called" }
+ fail_proc = -> { raise "This shouldn't have been called" }
@numerous.send(@method, fail_proc) {|e| e == @elements.first }.should == 2
end
it "calls the ifnone proc only once when the block is false" do
times = 0
- fail_proc = lambda { times += 1; raise if times > 1; "cheeseburgers" }
+ fail_proc = -> { times += 1; raise if times > 1; "cheeseburgers" }
@numerous.send(@method, fail_proc) {|e| false }.should == "cheeseburgers"
end
it "calls the ifnone proc when there are no elements" do
- fail_proc = lambda { "yay" }
+ fail_proc = -> { "yay" }
@empty.send(@method, fail_proc) {|e| true}.should == "yay"
end
@@ -64,7 +64,7 @@ describe :enumerable_find, shared: true do
it "passes the ifnone proc to the enumerator" do
times = 0
- fail_proc = lambda { times += 1; raise if times > 1; "cheeseburgers" }
+ fail_proc = -> { times += 1; raise if times > 1; "cheeseburgers" }
@numerous.send(@method, fail_proc).each {|e| false }.should == "cheeseburgers"
end
diff --git a/spec/ruby/core/enumerable/shared/take.rb b/spec/ruby/core/enumerable/shared/take.rb
index bf2536acda..ce2ace20fa 100644
--- a/spec/ruby/core/enumerable/shared/take.rb
+++ b/spec/ruby/core/enumerable/shared/take.rb
@@ -25,7 +25,7 @@ describe :enumerable_take, shared: true do
end
it "raises an ArgumentError when count is negative" do
- lambda { @enum.send(@method, -1) }.should raise_error(ArgumentError)
+ -> { @enum.send(@method, -1) }.should raise_error(ArgumentError)
end
it "returns the entire array when count > length" do
@@ -40,11 +40,11 @@ describe :enumerable_take, shared: true do
end
it "raises a TypeError if the passed argument is not numeric" do
- lambda { @enum.send(@method, nil) }.should raise_error(TypeError)
- lambda { @enum.send(@method, "a") }.should raise_error(TypeError)
+ -> { @enum.send(@method, nil) }.should raise_error(TypeError)
+ -> { @enum.send(@method, "a") }.should raise_error(TypeError)
obj = mock("nonnumeric")
- lambda { @enum.send(@method, obj) }.should raise_error(TypeError)
+ -> { @enum.send(@method, obj) }.should raise_error(TypeError)
end
it "gathers whole arrays as elements when each yields multiple" do