summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array
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/array
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/array')
-rw-r--r--spec/ruby/core/array/allocate_spec.rb2
-rw-r--r--spec/ruby/core/array/append_spec.rb2
-rw-r--r--spec/ruby/core/array/at_spec.rb4
-rw-r--r--spec/ruby/core/array/bsearch_index_spec.rb2
-rw-r--r--spec/ruby/core/array/bsearch_spec.rb4
-rw-r--r--spec/ruby/core/array/clear_spec.rb4
-rw-r--r--spec/ruby/core/array/compact_spec.rb2
-rw-r--r--spec/ruby/core/array/concat_spec.rb4
-rw-r--r--spec/ruby/core/array/cycle_spec.rb16
-rw-r--r--spec/ruby/core/array/delete_at_spec.rb2
-rw-r--r--spec/ruby/core/array/delete_if_spec.rb4
-rw-r--r--spec/ruby/core/array/delete_spec.rb2
-rw-r--r--spec/ruby/core/array/dig_spec.rb6
-rw-r--r--spec/ruby/core/array/drop_spec.rb2
-rw-r--r--spec/ruby/core/array/element_set_spec.rb48
-rw-r--r--spec/ruby/core/array/fetch_spec.rb10
-rw-r--r--spec/ruby/core/array/fill_spec.rb72
-rw-r--r--spec/ruby/core/array/first_spec.rb10
-rw-r--r--spec/ruby/core/array/flatten_spec.rb22
-rw-r--r--spec/ruby/core/array/hash_spec.rb4
-rw-r--r--spec/ruby/core/array/initialize_spec.rb24
-rw-r--r--spec/ruby/core/array/insert_spec.rb10
-rw-r--r--spec/ruby/core/array/join_spec.rb4
-rw-r--r--spec/ruby/core/array/last_spec.rb8
-rw-r--r--spec/ruby/core/array/max_spec.rb6
-rw-r--r--spec/ruby/core/array/min_spec.rb6
-rw-r--r--spec/ruby/core/array/multiply_spec.rb12
-rw-r--r--spec/ruby/core/array/new_spec.rb20
-rw-r--r--spec/ruby/core/array/pack/buffer_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/m_spec.rb8
-rw-r--r--spec/ruby/core/array/pack/percent_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/shared/basic.rb10
-rw-r--r--spec/ruby/core/array/pack/shared/encodings.rb4
-rw-r--r--spec/ruby/core/array/pack/shared/float.rb8
-rw-r--r--spec/ruby/core/array/pack/shared/numeric_basic.rb14
-rw-r--r--spec/ruby/core/array/pack/shared/string.rb6
-rw-r--r--spec/ruby/core/array/pack/shared/unicode.rb6
-rw-r--r--spec/ruby/core/array/pack/u_spec.rb8
-rw-r--r--spec/ruby/core/array/pack/w_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/x_spec.rb4
-rw-r--r--spec/ruby/core/array/pop_spec.rb16
-rw-r--r--spec/ruby/core/array/product_spec.rb6
-rw-r--r--spec/ruby/core/array/reject_spec.rb4
-rw-r--r--spec/ruby/core/array/reverse_spec.rb2
-rw-r--r--spec/ruby/core/array/rotate_spec.rb16
-rw-r--r--spec/ruby/core/array/sample_spec.rb12
-rw-r--r--spec/ruby/core/array/shared/collect.rb10
-rw-r--r--spec/ruby/core/array/shared/difference.rb2
-rw-r--r--spec/ruby/core/array/shared/inspect.rb2
-rw-r--r--spec/ruby/core/array/shared/join.rb10
-rw-r--r--spec/ruby/core/array/shared/keep_if.rb8
-rw-r--r--spec/ruby/core/array/shared/push.rb4
-rw-r--r--spec/ruby/core/array/shared/replace.rb2
-rw-r--r--spec/ruby/core/array/shared/slice.rb16
-rw-r--r--spec/ruby/core/array/shared/unshift.rb4
-rw-r--r--spec/ruby/core/array/shift_spec.rb12
-rw-r--r--spec/ruby/core/array/shuffle_spec.rb10
-rw-r--r--spec/ruby/core/array/slice_spec.rb6
-rw-r--r--spec/ruby/core/array/sort_by_spec.rb4
-rw-r--r--spec/ruby/core/array/sort_spec.rb10
-rw-r--r--spec/ruby/core/array/sum_spec.rb4
-rw-r--r--spec/ruby/core/array/take_spec.rb2
-rw-r--r--spec/ruby/core/array/to_h_spec.rb6
-rw-r--r--spec/ruby/core/array/transpose_spec.rb4
-rw-r--r--spec/ruby/core/array/try_convert_spec.rb4
-rw-r--r--spec/ruby/core/array/uniq_spec.rb8
66 files changed, 285 insertions, 285 deletions
diff --git a/spec/ruby/core/array/allocate_spec.rb b/spec/ruby/core/array/allocate_spec.rb
index a1800e7e16..04f7c0d0ad 100644
--- a/spec/ruby/core/array/allocate_spec.rb
+++ b/spec/ruby/core/array/allocate_spec.rb
@@ -14,6 +14,6 @@ describe "Array.allocate" do
end
it "does not accept any arguments" do
- lambda { Array.allocate(1) }.should raise_error(ArgumentError)
+ -> { Array.allocate(1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/append_spec.rb b/spec/ruby/core/array/append_spec.rb
index 08ea814d89..302dc4a901 100644
--- a/spec/ruby/core/array/append_spec.rb
+++ b/spec/ruby/core/array/append_spec.rb
@@ -31,7 +31,7 @@ describe "Array#<<" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/at_spec.rb b/spec/ruby/core/array/at_spec.rb
index d237c9508a..8bc789fef7 100644
--- a/spec/ruby/core/array/at_spec.rb
+++ b/spec/ruby/core/array/at_spec.rb
@@ -47,10 +47,10 @@ describe "Array#at" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { [].at("cat") }.should raise_error(TypeError)
+ -> { [].at("cat") }.should raise_error(TypeError)
end
it "raises an ArgumentError when 2 or more arguments are passed" do
- lambda { [:a, :b].at(0,1) }.should raise_error(ArgumentError)
+ -> { [:a, :b].at(0,1) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/bsearch_index_spec.rb b/spec/ruby/core/array/bsearch_index_spec.rb
index a075d06ed3..aafded178d 100644
--- a/spec/ruby/core/array/bsearch_index_spec.rb
+++ b/spec/ruby/core/array/bsearch_index_spec.rb
@@ -21,7 +21,7 @@ describe "Array#bsearch_index" do
end
it "raises a TypeError when block returns a String" do
- lambda { [1, 2, 3].bsearch_index { "not ok" } }.should raise_error(TypeError)
+ -> { [1, 2, 3].bsearch_index { "not ok" } }.should raise_error(TypeError)
end
it "returns nil when block is empty" do
diff --git a/spec/ruby/core/array/bsearch_spec.rb b/spec/ruby/core/array/bsearch_spec.rb
index 57b95fb934..8fa6245dbf 100644
--- a/spec/ruby/core/array/bsearch_spec.rb
+++ b/spec/ruby/core/array/bsearch_spec.rb
@@ -9,11 +9,11 @@ describe "Array#bsearch" do
it_behaves_like :enumeratorized_with_unknown_size, :bsearch, [1,2,3]
it "raises a TypeError if the block returns an Object" do
- lambda { [1].bsearch { Object.new } }.should raise_error(TypeError)
+ -> { [1].bsearch { Object.new } }.should raise_error(TypeError)
end
it "raises a TypeError if the block returns a String" do
- lambda { [1].bsearch { "1" } }.should raise_error(TypeError)
+ -> { [1].bsearch { "1" } }.should raise_error(TypeError)
end
context "with a block returning true or false" do
diff --git a/spec/ruby/core/array/clear_spec.rb b/spec/ruby/core/array/clear_spec.rb
index 8cba1f9e27..8f83a012b7 100644
--- a/spec/ruby/core/array/clear_spec.rb
+++ b/spec/ruby/core/array/clear_spec.rb
@@ -29,7 +29,7 @@ describe "Array#clear" do
end
it "does not accept any arguments" do
- lambda { [1].clear(true) }.should raise_error(ArgumentError)
+ -> { [1].clear(true) }.should raise_error(ArgumentError)
end
it "keeps untrusted status" do
@@ -43,6 +43,6 @@ describe "Array#clear" do
it "raises a #{frozen_error_class} on a frozen array" do
a = [1]
a.freeze
- lambda { a.clear }.should raise_error(frozen_error_class)
+ -> { a.clear }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/compact_spec.rb b/spec/ruby/core/array/compact_spec.rb
index 4818217be1..ecccddeb9f 100644
--- a/spec/ruby/core/array/compact_spec.rb
+++ b/spec/ruby/core/array/compact_spec.rb
@@ -72,6 +72,6 @@ describe "Array#compact!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.compact! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.compact! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/concat_spec.rb b/spec/ruby/core/array/concat_spec.rb
index 91adb8b745..cc707d9948 100644
--- a/spec/ruby/core/array/concat_spec.rb
+++ b/spec/ruby/core/array/concat_spec.rb
@@ -33,12 +33,12 @@ describe "Array#concat" do
end
it "raises a #{frozen_error_class} when Array is frozen and modification occurs" do
- lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.concat [1] }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} when Array is frozen and no modification occurs" do
- lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.concat([]) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/cycle_spec.rb b/spec/ruby/core/array/cycle_spec.rb
index 018005abb4..7219b49883 100644
--- a/spec/ruby/core/array/cycle_spec.rb
+++ b/spec/ruby/core/array/cycle_spec.rb
@@ -6,7 +6,7 @@ describe "Array#cycle" do
ScratchPad.record []
@array = [1, 2, 3]
- @prc = lambda { |x| ScratchPad << x }
+ @prc = -> x { ScratchPad << x }
end
it "does not yield and returns nil when the array is empty and passed value is an integer" do
@@ -46,13 +46,13 @@ describe "Array#cycle" do
end
it "does not rescue StopIteration when not passed a count" do
- lambda do
+ -> do
@array.cycle { raise StopIteration }
end.should raise_error(StopIteration)
end
it "does not rescue StopIteration when passed a count" do
- lambda do
+ -> do
@array.cycle(3) { raise StopIteration }
end.should raise_error(StopIteration)
end
@@ -74,23 +74,23 @@ describe "Array#cycle" do
count = mock("cycle count 2")
count.should_receive(:to_int).and_return("2")
- lambda { @array.cycle(count, &@prc) }.should raise_error(TypeError)
+ -> { @array.cycle(count, &@prc) }.should raise_error(TypeError)
end
it "raises a TypeError if passed a String" do
- lambda { @array.cycle("4") { } }.should raise_error(TypeError)
+ -> { @array.cycle("4") { } }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Object" do
- lambda { @array.cycle(mock("cycle count")) { } }.should raise_error(TypeError)
+ -> { @array.cycle(mock("cycle count")) { } }.should raise_error(TypeError)
end
it "raises a TypeError if passed true" do
- lambda { @array.cycle(true) { } }.should raise_error(TypeError)
+ -> { @array.cycle(true) { } }.should raise_error(TypeError)
end
it "raises a TypeError if passed false" do
- lambda { @array.cycle(false) { } }.should raise_error(TypeError)
+ -> { @array.cycle(false) { } }.should raise_error(TypeError)
end
before :all do
diff --git a/spec/ruby/core/array/delete_at_spec.rb b/spec/ruby/core/array/delete_at_spec.rb
index 021554c76a..c3111fe3d8 100644
--- a/spec/ruby/core/array/delete_at_spec.rb
+++ b/spec/ruby/core/array/delete_at_spec.rb
@@ -36,7 +36,7 @@ describe "Array#delete_at" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { [1,2,3].freeze.delete_at(0) }.should raise_error(frozen_error_class)
+ -> { [1,2,3].freeze.delete_at(0) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_if_spec.rb b/spec/ruby/core/array/delete_if_spec.rb
index 12a7d1662d..9f22f7e086 100644
--- a/spec/ruby/core/array/delete_if_spec.rb
+++ b/spec/ruby/core/array/delete_if_spec.rb
@@ -40,11 +40,11 @@ describe "Array#delete_if" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.delete_if {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.delete_if {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_spec.rb b/spec/ruby/core/array/delete_spec.rb
index 62476f489b..c55f4ad672 100644
--- a/spec/ruby/core/array/delete_spec.rb
+++ b/spec/ruby/core/array/delete_spec.rb
@@ -41,7 +41,7 @@ describe "Array#delete" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(frozen_error_class)
+ -> { [1, 2, 3].freeze.delete(1) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/dig_spec.rb b/spec/ruby/core/array/dig_spec.rb
index 1ace4893ee..f2d8ff47fd 100644
--- a/spec/ruby/core/array/dig_spec.rb
+++ b/spec/ruby/core/array/dig_spec.rb
@@ -20,20 +20,20 @@ describe "Array#dig" do
end
it "raises a TypeError for a non-numeric index" do
- lambda {
+ -> {
['a'].dig(:first)
}.should raise_error(TypeError)
end
it "raises a TypeError if any intermediate step does not respond to #dig" do
a = [1, 2]
- lambda {
+ -> {
a.dig(0, 1)
}.should raise_error(TypeError)
end
it "raises an ArgumentError if no arguments provided" do
- lambda {
+ -> {
[10].dig()
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/array/drop_spec.rb b/spec/ruby/core/array/drop_spec.rb
index 1bd2e6cc25..89b8534af4 100644
--- a/spec/ruby/core/array/drop_spec.rb
+++ b/spec/ruby/core/array/drop_spec.rb
@@ -6,7 +6,7 @@ describe "Array#drop" do
end
it "raises an ArgumentError if the number of elements specified is negative" do
- lambda { [1, 2].drop(-3) }.should raise_error(ArgumentError)
+ -> { [1, 2].drop(-3) }.should raise_error(ArgumentError)
end
it "returns an empty Array if all elements are dropped" do
diff --git a/spec/ruby/core/array/element_set_spec.rb b/spec/ruby/core/array/element_set_spec.rb
index 9992e4d32b..9375ff9b80 100644
--- a/spec/ruby/core/array/element_set_spec.rb
+++ b/spec/ruby/core/array/element_set_spec.rb
@@ -94,8 +94,8 @@ describe "Array#[]=" do
it "checks frozen before attempting to coerce arguments" do
a = [1,2,3,4].freeze
- lambda {a[:foo] = 1}.should raise_error(frozen_error_class)
- lambda {a[:foo, :bar] = 1}.should raise_error(frozen_error_class)
+ -> {a[:foo] = 1}.should raise_error(frozen_error_class)
+ -> {a[:foo, :bar] = 1}.should raise_error(frozen_error_class)
end
it "sets elements in the range arguments when passed ranges" do
@@ -195,25 +195,25 @@ describe "Array#[]=" do
a[to .. from] = ["x"]
a.should == [1, "a", "b", "x", "c", 4]
- lambda { a["a" .. "b"] = [] }.should raise_error(TypeError)
- lambda { a[from .. "b"] = [] }.should raise_error(TypeError)
+ -> { a["a" .. "b"] = [] }.should raise_error(TypeError)
+ -> { a[from .. "b"] = [] }.should raise_error(TypeError)
end
it "raises an IndexError when passed indexes out of bounds" do
a = [1, 2, 3, 4]
- lambda { a[-5] = "" }.should raise_error(IndexError)
- lambda { a[-5, -1] = "" }.should raise_error(IndexError)
- lambda { a[-5, 0] = "" }.should raise_error(IndexError)
- lambda { a[-5, 1] = "" }.should raise_error(IndexError)
- lambda { a[-5, 2] = "" }.should raise_error(IndexError)
- lambda { a[-5, 10] = "" }.should raise_error(IndexError)
-
- lambda { a[-5..-5] = "" }.should raise_error(RangeError)
- lambda { a[-5...-5] = "" }.should raise_error(RangeError)
- lambda { a[-5..-4] = "" }.should raise_error(RangeError)
- lambda { a[-5...-4] = "" }.should raise_error(RangeError)
- lambda { a[-5..10] = "" }.should raise_error(RangeError)
- lambda { a[-5...10] = "" }.should raise_error(RangeError)
+ -> { a[-5] = "" }.should raise_error(IndexError)
+ -> { a[-5, -1] = "" }.should raise_error(IndexError)
+ -> { a[-5, 0] = "" }.should raise_error(IndexError)
+ -> { a[-5, 1] = "" }.should raise_error(IndexError)
+ -> { a[-5, 2] = "" }.should raise_error(IndexError)
+ -> { a[-5, 10] = "" }.should raise_error(IndexError)
+
+ -> { a[-5..-5] = "" }.should raise_error(RangeError)
+ -> { a[-5...-5] = "" }.should raise_error(RangeError)
+ -> { a[-5..-4] = "" }.should raise_error(RangeError)
+ -> { a[-5...-4] = "" }.should raise_error(RangeError)
+ -> { a[-5..10] = "" }.should raise_error(RangeError)
+ -> { a[-5...10] = "" }.should raise_error(RangeError)
# ok
a[0..-9] = [1]
@@ -237,7 +237,7 @@ describe "Array#[]=" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(frozen_error_class)
end
end
@@ -337,12 +337,12 @@ describe "Array#[]= with [index, count]" do
it "raises an IndexError when passed start and negative length" do
a = [1, 2, 3, 4]
- lambda { a[-2, -1] = "" }.should raise_error(IndexError)
- lambda { a[0, -1] = "" }.should raise_error(IndexError)
- lambda { a[2, -1] = "" }.should raise_error(IndexError)
- lambda { a[4, -1] = "" }.should raise_error(IndexError)
- lambda { a[10, -1] = "" }.should raise_error(IndexError)
- lambda { [1, 2, 3, 4, 5][2, -1] = [7, 8] }.should raise_error(IndexError)
+ -> { a[-2, -1] = "" }.should raise_error(IndexError)
+ -> { a[0, -1] = "" }.should raise_error(IndexError)
+ -> { a[2, -1] = "" }.should raise_error(IndexError)
+ -> { a[4, -1] = "" }.should raise_error(IndexError)
+ -> { a[10, -1] = "" }.should raise_error(IndexError)
+ -> { [1, 2, 3, 4, 5][2, -1] = [7, 8] }.should raise_error(IndexError)
end
end
diff --git a/spec/ruby/core/array/fetch_spec.rb b/spec/ruby/core/array/fetch_spec.rb
index ccca463935..b81c0b48d7 100644
--- a/spec/ruby/core/array/fetch_spec.rb
+++ b/spec/ruby/core/array/fetch_spec.rb
@@ -12,9 +12,9 @@ describe "Array#fetch" do
end
it "raises an IndexError if there is no element at index" do
- lambda { [1, 2, 3].fetch(3) }.should raise_error(IndexError)
- lambda { [1, 2, 3].fetch(-4) }.should raise_error(IndexError)
- lambda { [].fetch(0) }.should raise_error(IndexError)
+ -> { [1, 2, 3].fetch(3) }.should raise_error(IndexError)
+ -> { [1, 2, 3].fetch(-4) }.should raise_error(IndexError)
+ -> { [].fetch(0) }.should raise_error(IndexError)
end
it "returns default if there is no element at index if passed a default value" do
@@ -37,7 +37,7 @@ describe "Array#fetch" do
end
it "gives precedence to the default block over the default argument" do
- lambda {
+ -> {
@result = [1, 2, 3].fetch(9, :foo) { |i| i * i }
}.should complain(/block supersedes default value argument/)
@result.should == 81
@@ -50,6 +50,6 @@ describe "Array#fetch" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { [].fetch("cat") }.should raise_error(TypeError)
+ -> { [].fetch("cat") }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/fill_spec.rb b/spec/ruby/core/array/fill_spec.rb
index f953613c26..1c1beef25e 100644
--- a/spec/ruby/core/array/fill_spec.rb
+++ b/spec/ruby/core/array/fill_spec.rb
@@ -3,7 +3,7 @@ require_relative 'fixtures/classes'
describe "Array#fill" do
before :all do
- @never_passed = lambda do |i|
+ @never_passed = -> i do
raise ExpectationNotMetError, "the control path should not pass here"
end
end
@@ -44,33 +44,33 @@ describe "Array#fill" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.fill('x') }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.fill('x') }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(frozen_error_class)
end
it "raises an ArgumentError if 4 or more arguments are passed when no block given" do
- lambda { [].fill('a') }.should_not raise_error(ArgumentError)
+ -> { [].fill('a') }.should_not raise_error(ArgumentError)
- lambda { [].fill('a', 1) }.should_not raise_error(ArgumentError)
+ -> { [].fill('a', 1) }.should_not raise_error(ArgumentError)
- lambda { [].fill('a', 1, 2) }.should_not raise_error(ArgumentError)
- lambda { [].fill('a', 1, 2, true) }.should raise_error(ArgumentError)
+ -> { [].fill('a', 1, 2) }.should_not raise_error(ArgumentError)
+ -> { [].fill('a', 1, 2, true) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if no argument passed and no block given" do
- lambda { [].fill }.should raise_error(ArgumentError)
+ -> { [].fill }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if 3 or more arguments are passed when a block given" do
- lambda { [].fill() {|i|} }.should_not raise_error(ArgumentError)
+ -> { [].fill() {|i|} }.should_not raise_error(ArgumentError)
- lambda { [].fill(1) {|i|} }.should_not raise_error(ArgumentError)
+ -> { [].fill(1) {|i|} }.should_not raise_error(ArgumentError)
- lambda { [].fill(1, 2) {|i|} }.should_not raise_error(ArgumentError)
- lambda { [].fill(1, 2, true) {|i|} }.should raise_error(ArgumentError)
+ -> { [].fill(1, 2) {|i|} }.should_not raise_error(ArgumentError)
+ -> { [].fill(1, 2, true) {|i|} }.should raise_error(ArgumentError)
end
end
@@ -171,23 +171,23 @@ describe "Array#fill with (filler, index, length)" do
# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/17481
it "does not raise an exception if the given length is negative and its absolute value does not exceed the index" do
- lambda { [1, 2, 3, 4].fill('a', 3, -1)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -2)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -3)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -1)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -2)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -3)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -1, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -2, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -3, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -1, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -2, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -3, &@never_passed)}.should_not raise_error(ArgumentError)
end
it "does not raise an exception even if the given length is negative and its absolute value exceeds the index" do
- lambda { [1, 2, 3, 4].fill('a', 3, -4)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -5)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill('a', 3, -10000)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -4)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -5)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill('a', 3, -10000)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -4, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -5, &@never_passed)}.should_not raise_error(ArgumentError)
- lambda { [1, 2, 3, 4].fill(3, -10000, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -4, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -5, &@never_passed)}.should_not raise_error(ArgumentError)
+ -> { [1, 2, 3, 4].fill(3, -10000, &@never_passed)}.should_not raise_error(ArgumentError)
end
it "tries to convert the second and third arguments to Integers using #to_int" do
@@ -199,17 +199,17 @@ describe "Array#fill with (filler, index, length)" do
end
it "raises a TypeError if the index is not numeric" do
- lambda { [].fill 'a', true }.should raise_error(TypeError)
+ -> { [].fill 'a', true }.should raise_error(TypeError)
obj = mock('nonnumeric')
- lambda { [].fill('a', obj) }.should raise_error(TypeError)
+ -> { [].fill('a', obj) }.should raise_error(TypeError)
end
not_supported_on :opal do
it "raises an ArgumentError or RangeError for too-large sizes" do
arr = [1, 2, 3]
- lambda { arr.fill(10, 1, fixnum_max) }.should raise_error(ArgumentError)
- lambda { arr.fill(10, 1, bignum_value) }.should raise_error(RangeError)
+ -> { arr.fill(10, 1, fixnum_max) }.should raise_error(ArgumentError)
+ -> { arr.fill(10, 1, bignum_value) }.should raise_error(RangeError)
end
end
end
@@ -239,7 +239,7 @@ describe "Array#fill with (filler, range)" do
end
it "raises a TypeError with range and length argument" do
- lambda { [].fill('x', 0 .. 2, 5) }.should raise_error(TypeError)
+ -> { [].fill('x', 0 .. 2, 5) }.should raise_error(TypeError)
end
it "replaces elements between the (-m)th to the last and the (n+1)th from the first if given an range m..n where m < 0 and n >= 0" do
@@ -291,13 +291,13 @@ describe "Array#fill with (filler, range)" do
end
it "raises an exception if some of the given range lies before the first of the array" do
- lambda { [1, 2, 3].fill('x', -5..-3) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill('x', -5...-3) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill('x', -5..-4) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill('x', -5..-3) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill('x', -5...-3) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill('x', -5..-4) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill(-5..-3, &@never_passed) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill(-5...-3, &@never_passed) }.should raise_error(RangeError)
- lambda { [1, 2, 3].fill(-5..-4, &@never_passed) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill(-5..-3, &@never_passed) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill(-5...-3, &@never_passed) }.should raise_error(RangeError)
+ -> { [1, 2, 3].fill(-5..-4, &@never_passed) }.should raise_error(RangeError)
end
it "tries to convert the start and end of the passed range to Integers using #to_int" do
@@ -312,6 +312,6 @@ describe "Array#fill with (filler, range)" do
it "raises a TypeError if the start or end of the passed range is not numeric" do
obj = mock('nonnumeric')
def obj.<=>(rhs); rhs == self ? 0 : nil end
- lambda { [].fill('a', obj..obj) }.should raise_error(TypeError)
+ -> { [].fill('a', obj..obj) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/first_spec.rb b/spec/ruby/core/array/first_spec.rb
index 5a0a25aeef..66eeba6565 100644
--- a/spec/ruby/core/array/first_spec.rb
+++ b/spec/ruby/core/array/first_spec.rb
@@ -30,11 +30,11 @@ describe "Array#first" do
end
it "raises an ArgumentError when count is negative" do
- lambda { [1, 2].first(-1) }.should raise_error(ArgumentError)
+ -> { [1, 2].first(-1) }.should raise_error(ArgumentError)
end
it "raises a RangeError when count is a Bignum" do
- lambda { [].first(bignum_value) }.should raise_error(RangeError)
+ -> { [].first(bignum_value) }.should raise_error(RangeError)
end
it "returns the entire array when count > length" do
@@ -66,11 +66,11 @@ describe "Array#first" do
end
it "raises a TypeError if the passed argument is not numeric" do
- lambda { [1,2].first(nil) }.should raise_error(TypeError)
- lambda { [1,2].first("a") }.should raise_error(TypeError)
+ -> { [1,2].first(nil) }.should raise_error(TypeError)
+ -> { [1,2].first("a") }.should raise_error(TypeError)
obj = mock("nonnumeric")
- lambda { [1,2].first(obj) }.should raise_error(TypeError)
+ -> { [1,2].first(obj) }.should raise_error(TypeError)
end
it "does not return subclass instance when passed count on Array subclasses" do
diff --git a/spec/ruby/core/array/flatten_spec.rb b/spec/ruby/core/array/flatten_spec.rb
index 1b7361552a..b506f899b4 100644
--- a/spec/ruby/core/array/flatten_spec.rb
+++ b/spec/ruby/core/array/flatten_spec.rb
@@ -30,7 +30,7 @@ describe "Array#flatten" do
it "raises a TypeError when the passed Object can't be converted to an Integer" do
obj = mock("Not converted")
- lambda { [ 1, 2, [3, [4, 5] ] ].flatten(obj) }.should raise_error(TypeError)
+ -> { [ 1, 2, [3, [4, 5] ] ].flatten(obj) }.should raise_error(TypeError)
end
it "does not call flatten on elements" do
@@ -46,13 +46,13 @@ describe "Array#flatten" do
it "raises an ArgumentError on recursive arrays" do
x = []
x << x
- lambda { x.flatten }.should raise_error(ArgumentError)
+ -> { x.flatten }.should raise_error(ArgumentError)
x = []
y = []
x << y
y << x
- lambda { x.flatten }.should raise_error(ArgumentError)
+ -> { x.flatten }.should raise_error(ArgumentError)
end
it "flattens any element which responds to #to_ary, using the return value of said method" do
@@ -106,7 +106,7 @@ describe "Array#flatten" do
it "raises a TypeError if #to_ary does not return an Array" do
@obj.should_receive(:to_ary).and_return(1)
- lambda { [@obj].flatten }.should raise_error(TypeError)
+ -> { [@obj].flatten }.should raise_error(TypeError)
end
ruby_version_is ""..."2.5" do
@@ -135,7 +135,7 @@ describe "Array#flatten" do
it "calls #to_ary if not defined when #respond_to_missing? returns true" do
def @obj.respond_to_missing?(name, priv) ScratchPad << name; true end
- lambda { [@obj].flatten }.should raise_error(NoMethodError)
+ -> { [@obj].flatten }.should raise_error(NoMethodError)
ScratchPad.recorded.should == [:to_ary]
end
@@ -226,7 +226,7 @@ describe "Array#flatten!" do
it "raises a TypeError when the passed Object can't be converted to an Integer" do
obj = mock("Not converted")
- lambda { [ 1, 2, [3, [4, 5] ] ].flatten!(obj) }.should raise_error(TypeError)
+ -> { [ 1, 2, [3, [4, 5] ] ].flatten!(obj) }.should raise_error(TypeError)
end
it "does not call flatten! on elements" do
@@ -242,13 +242,13 @@ describe "Array#flatten!" do
it "raises an ArgumentError on recursive arrays" do
x = []
x << x
- lambda { x.flatten! }.should raise_error(ArgumentError)
+ -> { x.flatten! }.should raise_error(ArgumentError)
x = []
y = []
x << y
y << x
- lambda { x.flatten! }.should raise_error(ArgumentError)
+ -> { x.flatten! }.should raise_error(ArgumentError)
end
it "flattens any elements which responds to #to_ary, using the return value of said method" do
@@ -273,12 +273,12 @@ describe "Array#flatten!" do
it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
nested_ary = [1, 2, []]
nested_ary.freeze
- lambda { nested_ary.flatten! }.should raise_error(frozen_error_class)
+ -> { nested_ary.flatten! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23663]
it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.flatten! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/hash_spec.rb b/spec/ruby/core/array/hash_spec.rb
index 638acff12b..8392253ae4 100644
--- a/spec/ruby/core/array/hash_spec.rb
+++ b/spec/ruby/core/array/hash_spec.rb
@@ -13,10 +13,10 @@ describe "Array#hash" do
it "properly handles recursive arrays" do
empty = ArraySpecs.empty_recursive_array
- lambda { empty.hash }.should_not raise_error
+ -> { empty.hash }.should_not raise_error
array = ArraySpecs.recursive_array
- lambda { array.hash }.should_not raise_error
+ -> { array.hash }.should_not raise_error
end
it "returns the same hash for equal recursive arrays" do
diff --git a/spec/ruby/core/array/initialize_spec.rb b/spec/ruby/core/array/initialize_spec.rb
index 350538a222..dfc2ae3518 100644
--- a/spec/ruby/core/array/initialize_spec.rb
+++ b/spec/ruby/core/array/initialize_spec.rb
@@ -24,19 +24,19 @@ describe "Array#initialize" do
end
it "raises an ArgumentError if passed 3 or more arguments" do
- lambda do
+ -> do
[1, 2].send :initialize, 1, 'x', true
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[1, 2].send(:initialize, 1, 'x', true) {}
end.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class} on frozen arrays" do
- lambda do
+ -> do
ArraySpecs.frozen_array.send :initialize
end.should raise_error(frozen_error_class)
- lambda do
+ -> do
ArraySpecs.frozen_array.send :initialize, ArraySpecs.frozen_array
end.should raise_error(frozen_error_class)
end
@@ -53,7 +53,7 @@ describe "Array#initialize with no arguments" do
end
it "does not use the given block" do
- lambda{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
+ ->{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
end
end
@@ -64,7 +64,7 @@ describe "Array#initialize with (array)" do
end
it "does not use the given block" do
- lambda{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
+ ->{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error
end
it "calls #to_ary to convert the value to an array" do
@@ -81,7 +81,7 @@ describe "Array#initialize with (array)" do
end
it "raises a TypeError if an Array type argument and a default object" do
- lambda { [].send(:initialize, [1, 2], 1) }.should raise_error(TypeError)
+ -> { [].send(:initialize, [1, 2], 1) }.should raise_error(TypeError)
end
end
@@ -103,12 +103,12 @@ describe "Array#initialize with (size, object=nil)" do
end
it "raises an ArgumentError if size is negative" do
- lambda { [].send(:initialize, -1, :a) }.should raise_error(ArgumentError)
- lambda { [].send(:initialize, -1) }.should raise_error(ArgumentError)
+ -> { [].send(:initialize, -1, :a) }.should raise_error(ArgumentError)
+ -> { [].send(:initialize, -1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if size is too large" do
- lambda { [].send(:initialize, fixnum_max+1) }.should raise_error(ArgumentError)
+ -> { [].send(:initialize, fixnum_max+1) }.should raise_error(ArgumentError)
end
it "calls #to_int to convert the size argument to an Integer when object is given" do
@@ -126,7 +126,7 @@ describe "Array#initialize with (size, object=nil)" do
it "raises a TypeError if the size argument is not an Integer type" do
obj = mock('nonnumeric')
obj.stub!(:to_ary).and_return([1, 2])
- lambda{ [].send(:initialize, obj, :a) }.should raise_error(TypeError)
+ ->{ [].send(:initialize, obj, :a) }.should raise_error(TypeError)
end
it "yields the index of the element and sets the element to the value of the block" do
@@ -134,7 +134,7 @@ describe "Array#initialize with (size, object=nil)" do
end
it "uses the block value instead of using the default value" do
- lambda {
+ -> {
@result = [].send(:initialize, 3, :obj) { |i| i.to_s }
}.should complain(/block supersedes default value argument/)
@result.should == ['0', '1', '2']
diff --git a/spec/ruby/core/array/insert_spec.rb b/spec/ruby/core/array/insert_spec.rb
index b65a14a6b7..7577a8f743 100644
--- a/spec/ruby/core/array/insert_spec.rb
+++ b/spec/ruby/core/array/insert_spec.rb
@@ -46,8 +46,8 @@ describe "Array#insert" do
end
it "raises an IndexError if the negative index is out of bounds" do
- lambda { [].insert(-2, 1) }.should raise_error(IndexError)
- lambda { [1].insert(-3, 2) }.should raise_error(IndexError)
+ -> { [].insert(-2, 1) }.should raise_error(IndexError)
+ -> { [1].insert(-3, 2) }.should raise_error(IndexError)
end
it "does nothing of no object is passed" do
@@ -64,15 +64,15 @@ describe "Array#insert" do
end
it "raises an ArgumentError if no argument passed" do
- lambda { [].insert() }.should raise_error(ArgumentError)
+ -> { [].insert() }.should raise_error(ArgumentError)
end
it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
- lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.insert(0) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/join_spec.rb b/spec/ruby/core/array/join_spec.rb
index 403bae7183..e78ea6f9e1 100644
--- a/spec/ruby/core/array/join_spec.rb
+++ b/spec/ruby/core/array/join_spec.rb
@@ -24,11 +24,11 @@ describe "Array#join" do
it "raises a TypeError if the separator cannot be coerced to a String by calling #to_str" do
obj = mock("not a string")
- lambda { [1, 2].join(obj) }.should raise_error(TypeError)
+ -> { [1, 2].join(obj) }.should raise_error(TypeError)
end
it "raises a TypeError if passed false as the separator" do
- lambda { [1, 2].join(false) }.should raise_error(TypeError)
+ -> { [1, 2].join(false) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/last_spec.rb b/spec/ruby/core/array/last_spec.rb
index 9bf8648776..d6fefada09 100644
--- a/spec/ruby/core/array/last_spec.rb
+++ b/spec/ruby/core/array/last_spec.rb
@@ -28,7 +28,7 @@ describe "Array#last" do
end
it "raises an ArgumentError when count is negative" do
- lambda { [1, 2].last(-1) }.should raise_error(ArgumentError)
+ -> { [1, 2].last(-1) }.should raise_error(ArgumentError)
end
it "returns the entire array when count > length" do
@@ -60,11 +60,11 @@ describe "Array#last" do
end
it "raises a TypeError if the passed argument is not numeric" do
- lambda { [1,2].last(nil) }.should raise_error(TypeError)
- lambda { [1,2].last("a") }.should raise_error(TypeError)
+ -> { [1,2].last(nil) }.should raise_error(TypeError)
+ -> { [1,2].last("a") }.should raise_error(TypeError)
obj = mock("nonnumeric")
- lambda { [1,2].last(obj) }.should raise_error(TypeError)
+ -> { [1,2].last(obj) }.should raise_error(TypeError)
end
it "does not return subclass instance on Array subclasses" do
diff --git a/spec/ruby/core/array/max_spec.rb b/spec/ruby/core/array/max_spec.rb
index 329b691883..d1c64519d0 100644
--- a/spec/ruby/core/array/max_spec.rb
+++ b/spec/ruby/core/array/max_spec.rb
@@ -68,16 +68,16 @@ describe "Array#max" do
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
[BasicObject.new, BasicObject.new].max
end.should raise_error(NoMethodError)
end
it "raises an ArgumentError for incomparable elements" do
- lambda do
+ -> do
[11,"22"].max
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[11,12,22,33].max{|a, b| nil}
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/array/min_spec.rb b/spec/ruby/core/array/min_spec.rb
index 22a179d808..3bdef0dd00 100644
--- a/spec/ruby/core/array/min_spec.rb
+++ b/spec/ruby/core/array/min_spec.rb
@@ -68,16 +68,16 @@ describe "Array#min" do
end
it "raises a NoMethodError for elements without #<=>" do
- lambda do
+ -> do
[BasicObject.new, BasicObject.new].min
end.should raise_error(NoMethodError)
end
it "raises an ArgumentError for incomparable elements" do
- lambda do
+ -> do
[11,"22"].min
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[11,12,22,33].min{|a, b| nil}
end.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/array/multiply_spec.rb b/spec/ruby/core/array/multiply_spec.rb
index f9ba20258a..ab654ce489 100644
--- a/spec/ruby/core/array/multiply_spec.rb
+++ b/spec/ruby/core/array/multiply_spec.rb
@@ -17,7 +17,7 @@ describe "Array#*" do
it "raises a TypeError if the argument can neither be converted to a string nor an integer" do
obj = mock('not a string or integer')
- lambda{ [1,2] * obj }.should raise_error(TypeError)
+ ->{ [1,2] * obj }.should raise_error(TypeError)
end
it "converts the passed argument to a String rather than an Integer" do
@@ -28,15 +28,15 @@ describe "Array#*" do
end
it "raises a TypeError is the passed argument is nil" do
- lambda{ [1,2] * nil }.should raise_error(TypeError)
+ ->{ [1,2] * nil }.should raise_error(TypeError)
end
it "raises an ArgumentError when passed 2 or more arguments" do
- lambda{ [1,2].send(:*, 1, 2) }.should raise_error(ArgumentError)
+ ->{ [1,2].send(:*, 1, 2) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed no arguments" do
- lambda{ [1,2].send(:*) }.should raise_error(ArgumentError)
+ ->{ [1,2].send(:*) }.should raise_error(ArgumentError)
end
end
@@ -65,8 +65,8 @@ describe "Array#* with an integer" do
end
it "raises an ArgumentError when passed a negative integer" do
- lambda { [ 1, 2, 3 ] * -1 }.should raise_error(ArgumentError)
- lambda { [] * -1 }.should raise_error(ArgumentError)
+ -> { [ 1, 2, 3 ] * -1 }.should raise_error(ArgumentError)
+ -> { [] * -1 }.should raise_error(ArgumentError)
end
describe "with a subclass of Array" do
diff --git a/spec/ruby/core/array/new_spec.rb b/spec/ruby/core/array/new_spec.rb
index d5e4b5722f..96ec6b8198 100644
--- a/spec/ruby/core/array/new_spec.rb
+++ b/spec/ruby/core/array/new_spec.rb
@@ -11,10 +11,10 @@ describe "Array.new" do
end
it "raises an ArgumentError if passed 3 or more arguments" do
- lambda do
+ -> do
[1, 2].send :initialize, 1, 'x', true
end.should raise_error(ArgumentError)
- lambda do
+ -> do
[1, 2].send(:initialize, 1, 'x', true) {}
end.should raise_error(ArgumentError)
end
@@ -26,7 +26,7 @@ describe "Array.new with no arguments" do
end
it "does not use the given block" do
- lambda{ Array.new { raise } }.should_not raise_error
+ ->{ Array.new { raise } }.should_not raise_error
end
end
@@ -37,7 +37,7 @@ describe "Array.new with (array)" do
end
it "does not use the given block" do
- lambda{ Array.new([1, 2]) { raise } }.should_not raise_error
+ ->{ Array.new([1, 2]) { raise } }.should_not raise_error
end
it "calls #to_ary to convert the value to an array" do
@@ -54,7 +54,7 @@ describe "Array.new with (array)" do
end
it "raises a TypeError if an Array type argument and a default object" do
- lambda { Array.new([1, 2], 1) }.should raise_error(TypeError)
+ -> { Array.new([1, 2], 1) }.should raise_error(TypeError)
end
end
@@ -74,12 +74,12 @@ describe "Array.new with (size, object=nil)" do
end
it "raises an ArgumentError if size is negative" do
- lambda { Array.new(-1, :a) }.should raise_error(ArgumentError)
- lambda { Array.new(-1) }.should raise_error(ArgumentError)
+ -> { Array.new(-1, :a) }.should raise_error(ArgumentError)
+ -> { Array.new(-1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if size is too large" do
- lambda { Array.new(fixnum_max+1) }.should raise_error(ArgumentError)
+ -> { Array.new(fixnum_max+1) }.should raise_error(ArgumentError)
end
it "calls #to_int to convert the size argument to an Integer when object is given" do
@@ -97,7 +97,7 @@ describe "Array.new with (size, object=nil)" do
it "raises a TypeError if the size argument is not an Integer type" do
obj = mock('nonnumeric')
obj.stub!(:to_ary).and_return([1, 2])
- lambda{ Array.new(obj, :a) }.should raise_error(TypeError)
+ ->{ Array.new(obj, :a) }.should raise_error(TypeError)
end
it "yields the index of the element and sets the element to the value of the block" do
@@ -105,7 +105,7 @@ describe "Array.new with (size, object=nil)" do
end
it "uses the block value instead of using the default value" do
- lambda {
+ -> {
@result = Array.new(3, :obj) { |i| i.to_s }
}.should complain(/block supersedes default value argument/)
@result.should == ['0', '1', '2']
diff --git a/spec/ruby/core/array/pack/buffer_spec.rb b/spec/ruby/core/array/pack/buffer_spec.rb
index a3a582996a..ecb40bfd06 100644
--- a/spec/ruby/core/array/pack/buffer_spec.rb
+++ b/spec/ruby/core/array/pack/buffer_spec.rb
@@ -24,7 +24,7 @@ describe "Array#pack with :buffer option" do
end
it "raises TypeError exception if buffer is not String" do
- lambda { [65].pack("ccc", buffer: []) }.should raise_error(
+ -> { [65].pack("ccc", buffer: []) }.should raise_error(
TypeError, "buffer must be String, not Array")
end
diff --git a/spec/ruby/core/array/pack/m_spec.rb b/spec/ruby/core/array/pack/m_spec.rb
index 40c2e3f1fa..2b1a84abca 100644
--- a/spec/ruby/core/array/pack/m_spec.rb
+++ b/spec/ruby/core/array/pack/m_spec.rb
@@ -285,16 +285,16 @@ describe "Array#pack with format 'm'" do
it "raises a TypeError if #to_str does not return a String" do
obj = mock("pack m non-string")
- lambda { [obj].pack("m") }.should raise_error(TypeError)
+ -> { [obj].pack("m") }.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda { [nil].pack("m") }.should raise_error(TypeError)
+ -> { [nil].pack("m") }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Integer" do
- lambda { [0].pack("m") }.should raise_error(TypeError)
- lambda { [bignum_value].pack("m") }.should raise_error(TypeError)
+ -> { [0].pack("m") }.should raise_error(TypeError)
+ -> { [bignum_value].pack("m") }.should raise_error(TypeError)
end
it "does not emit a newline if passed zero as the count modifier" do
diff --git a/spec/ruby/core/array/pack/percent_spec.rb b/spec/ruby/core/array/pack/percent_spec.rb
index 3c0e7eca0f..5d56dea5fe 100644
--- a/spec/ruby/core/array/pack/percent_spec.rb
+++ b/spec/ruby/core/array/pack/percent_spec.rb
@@ -2,6 +2,6 @@ require_relative '../../../spec_helper'
describe "Array#pack with format '%'" do
it "raises an Argument Error" do
- lambda { [1].pack("%") }.should raise_error(ArgumentError)
+ -> { [1].pack("%") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/basic.rb b/spec/ruby/core/array/pack/shared/basic.rb
index 39ab15308d..bc366987c8 100644
--- a/spec/ruby/core/array/pack/shared/basic.rb
+++ b/spec/ruby/core/array/pack/shared/basic.rb
@@ -1,6 +1,6 @@
describe :array_pack_arguments, shared: true do
it "raises an ArgumentError if there are fewer elements than the format requires" do
- lambda { [].pack(pack_format(1)) }.should raise_error(ArgumentError)
+ -> { [].pack(pack_format(1)) }.should raise_error(ArgumentError)
end
end
@@ -10,11 +10,11 @@ describe :array_pack_basic, shared: true do
end
it "raises a TypeError when passed nil" do
- lambda { [@obj].pack(nil) }.should raise_error(TypeError)
+ -> { [@obj].pack(nil) }.should raise_error(TypeError)
end
it "raises a TypeError when passed an Integer" do
- lambda { [@obj].pack(1) }.should raise_error(TypeError)
+ -> { [@obj].pack(1) }.should raise_error(TypeError)
end
end
@@ -56,10 +56,10 @@ end
describe :array_pack_no_platform, shared: true do
it "raises ArgumentError when the format modifier is '_'" do
- lambda{ [1].pack(pack_format("_")) }.should raise_error(ArgumentError)
+ ->{ [1].pack(pack_format("_")) }.should raise_error(ArgumentError)
end
it "raises ArgumentError when the format modifier is '!'" do
- lambda{ [1].pack(pack_format("!")) }.should raise_error(ArgumentError)
+ ->{ [1].pack(pack_format("!")) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/encodings.rb b/spec/ruby/core/array/pack/shared/encodings.rb
index 3724a5d859..6b7ffac764 100644
--- a/spec/ruby/core/array/pack/shared/encodings.rb
+++ b/spec/ruby/core/array/pack/shared/encodings.rb
@@ -5,12 +5,12 @@ describe :array_pack_hex, shared: true do
it "raises a TypeError if the object does not respond to #to_str" do
obj = mock("pack hex non-string")
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError if #to_str does not return a String" do
obj = mock("pack hex non-string")
obj.should_receive(:to_str).and_return(1)
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/float.rb b/spec/ruby/core/array/pack/shared/float.rb
index 6cd326ce9c..c6b194007f 100644
--- a/spec/ruby/core/array/pack/shared/float.rb
+++ b/spec/ruby/core/array/pack/shared/float.rb
@@ -14,7 +14,7 @@ describe :array_pack_float_le, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
@@ -69,7 +69,7 @@ describe :array_pack_float_be, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
@@ -124,7 +124,7 @@ describe :array_pack_double_le, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
@@ -183,7 +183,7 @@ describe :array_pack_double_be, shared: true do
end
it "raises a TypeError if passed a String representation of a floating point number" do
- lambda { ["13"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["13"].pack(pack_format) }.should raise_error(TypeError)
end
it "encodes the number of array elements specified by the count modifier" do
diff --git a/spec/ruby/core/array/pack/shared/numeric_basic.rb b/spec/ruby/core/array/pack/shared/numeric_basic.rb
index 3ebdbc4c1a..7c36ba4a32 100644
--- a/spec/ruby/core/array/pack/shared/numeric_basic.rb
+++ b/spec/ruby/core/array/pack/shared/numeric_basic.rb
@@ -4,15 +4,15 @@ describe :array_pack_numeric_basic, shared: true do
end
it "raises a TypeError when passed nil" do
- lambda { [nil].pack(pack_format) }.should raise_error(TypeError)
+ -> { [nil].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when passed true" do
- lambda { [true].pack(pack_format) }.should raise_error(TypeError)
+ -> { [true].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when passed false" do
- lambda { [false].pack(pack_format) }.should raise_error(TypeError)
+ -> { [false].pack(pack_format) }.should raise_error(TypeError)
end
it "returns a binary string" do
@@ -24,21 +24,21 @@ end
describe :array_pack_integer, shared: true do
it "raises a TypeError when the object does not respond to #to_int" do
obj = mock('not an integer')
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when passed a String" do
- lambda { ["5"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["5"].pack(pack_format) }.should raise_error(TypeError)
end
end
describe :array_pack_float, shared: true do
it "raises a TypeError if a String does not represent a floating point number" do
- lambda { ["a"].pack(pack_format) }.should raise_error(TypeError)
+ -> { ["a"].pack(pack_format) }.should raise_error(TypeError)
end
it "raises a TypeError when the object does not respond to #to_f" do
obj = mock('not an float')
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/core/array/pack/shared/string.rb b/spec/ruby/core/array/pack/shared/string.rb
index 98e8c4d562..8c82e8c617 100644
--- a/spec/ruby/core/array/pack/shared/string.rb
+++ b/spec/ruby/core/array/pack/shared/string.rb
@@ -17,11 +17,11 @@ describe :array_pack_string, shared: true do
end
it "raises an ArgumentError when the Array is empty" do
- lambda { [].pack(pack_format) }.should raise_error(ArgumentError)
+ -> { [].pack(pack_format) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when the Array has too few elements" do
- lambda { ["a"].pack(pack_format(nil, 2)) }.should raise_error(ArgumentError)
+ -> { ["a"].pack(pack_format(nil, 2)) }.should raise_error(ArgumentError)
end
it "calls #to_str to convert the element to a String" do
@@ -33,7 +33,7 @@ describe :array_pack_string, shared: true do
it "raises a TypeError when the object does not respond to #to_str" do
obj = mock("not a string")
- lambda { [obj].pack(pack_format) }.should raise_error(TypeError)
+ -> { [obj].pack(pack_format) }.should raise_error(TypeError)
end
it "returns a string in encoding of common to the concatenated results" do
diff --git a/spec/ruby/core/array/pack/shared/unicode.rb b/spec/ruby/core/array/pack/shared/unicode.rb
index e16110c491..dd0f8b38aa 100644
--- a/spec/ruby/core/array/pack/shared/unicode.rb
+++ b/spec/ruby/core/array/pack/shared/unicode.rb
@@ -64,7 +64,7 @@ describe :array_pack_unicode, shared: true do
it "raises a TypeError if #to_int does not return an Integer" do
obj = mock('to_int')
obj.should_receive(:to_int).and_return("5")
- lambda { [obj].pack("U") }.should raise_error(TypeError)
+ -> { [obj].pack("U") }.should raise_error(TypeError)
end
it "ignores NULL bytes between directives" do
@@ -76,11 +76,11 @@ describe :array_pack_unicode, shared: true do
end
it "raises a RangeError if passed a negative number" do
- lambda { [-1].pack("U") }.should raise_error(RangeError)
+ -> { [-1].pack("U") }.should raise_error(RangeError)
end
it "raises a RangeError if passed a number larger than an unsigned 32-bit integer" do
- lambda { [2**32].pack("U") }.should raise_error(RangeError)
+ -> { [2**32].pack("U") }.should raise_error(RangeError)
end
it "sets the output string to UTF-8 encoding" do
diff --git a/spec/ruby/core/array/pack/u_spec.rb b/spec/ruby/core/array/pack/u_spec.rb
index 8c3eb3a177..fe969cbb2d 100644
--- a/spec/ruby/core/array/pack/u_spec.rb
+++ b/spec/ruby/core/array/pack/u_spec.rb
@@ -112,16 +112,16 @@ describe "Array#pack with format 'u'" do
it "raises a TypeError if #to_str does not return a String" do
obj = mock("pack m non-string")
- lambda { [obj].pack("u") }.should raise_error(TypeError)
+ -> { [obj].pack("u") }.should raise_error(TypeError)
end
it "raises a TypeError if passed nil" do
- lambda { [nil].pack("u") }.should raise_error(TypeError)
+ -> { [nil].pack("u") }.should raise_error(TypeError)
end
it "raises a TypeError if passed an Integer" do
- lambda { [0].pack("u") }.should raise_error(TypeError)
- lambda { [bignum_value].pack("u") }.should raise_error(TypeError)
+ -> { [0].pack("u") }.should raise_error(TypeError)
+ -> { [bignum_value].pack("u") }.should raise_error(TypeError)
end
it "sets the output string to US-ASCII encoding" do
diff --git a/spec/ruby/core/array/pack/w_spec.rb b/spec/ruby/core/array/pack/w_spec.rb
index 889f42bdf7..439fa02198 100644
--- a/spec/ruby/core/array/pack/w_spec.rb
+++ b/spec/ruby/core/array/pack/w_spec.rb
@@ -33,7 +33,7 @@ describe "Array#pack with format 'w'" do
end
it "raises an ArgumentError when passed a negative value" do
- lambda { [-1].pack("w") }.should raise_error(ArgumentError)
+ -> { [-1].pack("w") }.should raise_error(ArgumentError)
end
it "returns a binary string" do
diff --git a/spec/ruby/core/array/pack/x_spec.rb b/spec/ruby/core/array/pack/x_spec.rb
index 2662873d03..a28dd0bf21 100644
--- a/spec/ruby/core/array/pack/x_spec.rb
+++ b/spec/ruby/core/array/pack/x_spec.rb
@@ -55,10 +55,10 @@ describe "Array#pack with format 'X'" do
end
it "raises an ArgumentError if the output string is empty" do
- lambda { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError)
+ -> { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the count modifier is greater than the bytes in the string" do
- lambda { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError)
+ -> { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/pop_spec.rb b/spec/ruby/core/array/pop_spec.rb
index 335a0f2b60..7dbd6cb3cc 100644
--- a/spec/ruby/core/array/pop_spec.rb
+++ b/spec/ruby/core/array/pop_spec.rb
@@ -39,11 +39,11 @@ describe "Array#pop" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.pop }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.pop }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.pop }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.pop }.should raise_error(frozen_error_class)
end
it "keeps untrusted status" do
@@ -105,7 +105,7 @@ describe "Array#pop" do
end
it "raises an ArgumentError if n is negative" do
- lambda{ [1, 2, 3].pop(-1) }.should raise_error(ArgumentError)
+ ->{ [1, 2, 3].pop(-1) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
@@ -120,12 +120,12 @@ describe "Array#pop" do
end
it "raises a TypeError when the passed n cannot be coerced to Integer" do
- lambda{ [1, 2].pop("cat") }.should raise_error(TypeError)
- lambda{ [1, 2].pop(nil) }.should raise_error(TypeError)
+ ->{ [1, 2].pop("cat") }.should raise_error(TypeError)
+ ->{ [1, 2].pop(nil) }.should raise_error(TypeError)
end
it "raises an ArgumentError if more arguments are passed" do
- lambda{ [1, 2].pop(1, 2) }.should raise_error(ArgumentError)
+ ->{ [1, 2].pop(1, 2) }.should raise_error(ArgumentError)
end
it "does not return subclass instances with Array subclass" do
@@ -153,8 +153,8 @@ describe "Array#pop" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.pop(2) }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.frozen_array.pop(0) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.pop(2) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.pop(0) }.should raise_error(frozen_error_class)
end
it "keeps untrusted status" do
diff --git a/spec/ruby/core/array/product_spec.rb b/spec/ruby/core/array/product_spec.rb
index 7d810b6196..07d2880a96 100644
--- a/spec/ruby/core/array/product_spec.rb
+++ b/spec/ruby/core/array/product_spec.rb
@@ -3,7 +3,7 @@ require_relative 'fixtures/classes'
describe "Array#product" do
it "returns converted arguments using :to_ary" do
- lambda{ [1].product(2..3) }.should raise_error(TypeError)
+ ->{ [1].product(2..3) }.should raise_error(TypeError)
ar = ArraySpecs::ArrayConvertible.new(2,3)
[1].product(ar).should == [[1,2],[1,3]]
ar.called.should == :to_ary
@@ -24,7 +24,7 @@ describe "Array#product" do
it "does not attempt to produce an unreasonable number of products" do
a = (0..100).to_a
- lambda do
+ -> do
a.product(a, a, a, a, a, a, a, a, a, a)
end.should raise_error(RangeError)
end
@@ -49,7 +49,7 @@ describe "Array#product" do
it "will ignore unreasonable numbers of products and yield anyway" do
a = (0..100).to_a
- lambda do
+ -> do
a.product(a, a, a, a, a, a, a, a, a, a)
end.should raise_error(RangeError)
end
diff --git a/spec/ruby/core/array/reject_spec.rb b/spec/ruby/core/array/reject_spec.rb
index 6ae2581ff5..1e9c296c8d 100644
--- a/spec/ruby/core/array/reject_spec.rb
+++ b/spec/ruby/core/array/reject_spec.rb
@@ -104,11 +104,11 @@ describe "Array#reject!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.reject! {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.reject! {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(frozen_error_class)
end
it "does not truncate the array is the block raises an exception" do
diff --git a/spec/ruby/core/array/reverse_spec.rb b/spec/ruby/core/array/reverse_spec.rb
index d8ff26639d..e738be6fe7 100644
--- a/spec/ruby/core/array/reverse_spec.rb
+++ b/spec/ruby/core/array/reverse_spec.rb
@@ -37,6 +37,6 @@ describe "Array#reverse!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.reverse! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.reverse! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/rotate_spec.rb b/spec/ruby/core/array/rotate_spec.rb
index 6450d3892b..cc1aabf986 100644
--- a/spec/ruby/core/array/rotate_spec.rb
+++ b/spec/ruby/core/array/rotate_spec.rb
@@ -27,10 +27,10 @@ describe "Array#rotate" do
end
it "raises a TypeError if not passed an integer-like argument" do
- lambda {
+ -> {
[1, 2].rotate(nil)
}.should raise_error(TypeError)
- lambda {
+ -> {
[1, 2].rotate("4")
}.should raise_error(TypeError)
end
@@ -46,7 +46,7 @@ describe "Array#rotate" do
end
it "does not mutate the receiver" do
- lambda {
+ -> {
[].freeze.rotate
[2].freeze.rotate(2)
[1,2,3].freeze.rotate(-3)
@@ -94,10 +94,10 @@ describe "Array#rotate!" do
end
it "raises a TypeError if not passed an integer-like argument" do
- lambda {
+ -> {
[1, 2].rotate!(nil)
}.should raise_error(TypeError)
- lambda {
+ -> {
[1, 2].rotate!("4")
}.should raise_error(TypeError)
end
@@ -122,8 +122,8 @@ describe "Array#rotate!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { [1, 2, 3].freeze.rotate!(0) }.should raise_error(frozen_error_class)
- lambda { [1].freeze.rotate!(42) }.should raise_error(frozen_error_class)
- lambda { [].freeze.rotate! }.should raise_error(frozen_error_class)
+ -> { [1, 2, 3].freeze.rotate!(0) }.should raise_error(frozen_error_class)
+ -> { [1].freeze.rotate!(42) }.should raise_error(frozen_error_class)
+ -> { [].freeze.rotate! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/sample_spec.rb b/spec/ruby/core/array/sample_spec.rb
index 3bd5d046cc..44be91ba18 100644
--- a/spec/ruby/core/array/sample_spec.rb
+++ b/spec/ruby/core/array/sample_spec.rb
@@ -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
diff --git a/spec/ruby/core/array/shared/collect.rb b/spec/ruby/core/array/shared/collect.rb
index 8ad6e61855..80e2739893 100644
--- a/spec/ruby/core/array/shared/collect.rb
+++ b/spec/ruby/core/array/shared/collect.rb
@@ -37,7 +37,7 @@ describe :array_collect, shared: true do
it "raises an ArgumentError when no block and with arguments" do
a = [1, 2, 3]
- lambda {
+ -> {
a.send(@method, :foo)
}.should raise_error(ArgumentError)
end
@@ -111,21 +111,21 @@ describe :array_collect_b, shared: true do
describe "when frozen" do
it "raises a #{frozen_error_class}" do
- lambda { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when empty" do
- lambda { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator" do
enumerator = ArraySpecs.frozen_array.send(@method)
- lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
+ -> { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator when empty" do
enumerator = ArraySpecs.empty_frozen_array.send(@method)
- lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
+ -> { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/difference.rb b/spec/ruby/core/array/shared/difference.rb
index c43a6375e0..3e69050d82 100644
--- a/spec/ruby/core/array/shared/difference.rb
+++ b/spec/ruby/core/array/shared/difference.rb
@@ -27,7 +27,7 @@ describe :array_binary_difference, shared: true do
it "raises a TypeError if the argument cannot be coerced to an Array by calling #to_ary" do
obj = mock('not an array')
- lambda { [1, 2, 3].send(@method, obj) }.should raise_error(TypeError)
+ -> { [1, 2, 3].send(@method, obj) }.should raise_error(TypeError)
end
it "does not return subclass instance for Array subclasses" do
diff --git a/spec/ruby/core/array/shared/inspect.rb b/spec/ruby/core/array/shared/inspect.rb
index 1bcc9f9ca8..434440c25b 100644
--- a/spec/ruby/core/array/shared/inspect.rb
+++ b/spec/ruby/core/array/shared/inspect.rb
@@ -55,7 +55,7 @@ describe :array_inspect, shared: true do
obj.should_receive(:inspect).and_return(obj)
obj.should_receive(:to_s).and_raise(Exception)
- lambda { [obj].send(@method) }.should raise_error(Exception)
+ -> { [obj].send(@method) }.should raise_error(Exception)
end
it "represents a recursive element with '[...]'" do
diff --git a/spec/ruby/core/array/shared/join.rb b/spec/ruby/core/array/shared/join.rb
index 0d07e93b2c..38bdde9502 100644
--- a/spec/ruby/core/array/shared/join.rb
+++ b/spec/ruby/core/array/shared/join.rb
@@ -49,13 +49,13 @@ describe :array_join_with_default_separator, shared: true do
it "raises a NoMethodError if an element does not respond to #to_str, #to_ary, or #to_s" do
obj = mock('o')
class << obj; undef :to_s; end
- lambda { [1, obj].send(@method) }.should raise_error(NoMethodError)
+ -> { [1, obj].send(@method) }.should raise_error(NoMethodError)
end
it "raises an ArgumentError when the Array is recursive" do
- lambda { ArraySpecs.recursive_array.send(@method) }.should raise_error(ArgumentError)
- lambda { ArraySpecs.head_recursive_array.send(@method) }.should raise_error(ArgumentError)
- lambda { ArraySpecs.empty_recursive_array.send(@method) }.should raise_error(ArgumentError)
+ -> { ArraySpecs.recursive_array.send(@method) }.should raise_error(ArgumentError)
+ -> { ArraySpecs.head_recursive_array.send(@method) }.should raise_error(ArgumentError)
+ -> { ArraySpecs.empty_recursive_array.send(@method) }.should raise_error(ArgumentError)
end
it "taints the result if the Array is tainted and non-empty" do
@@ -109,7 +109,7 @@ describe :array_join_with_default_separator, shared: true do
it "fails for arrays with incompatibly-encoded strings" do
ary_utf8_bad_binary = ArraySpecs.array_with_utf8_and_binary_strings
- lambda { ary_utf8_bad_binary.send(@method) }.should raise_error(EncodingError)
+ -> { ary_utf8_bad_binary.send(@method) }.should raise_error(EncodingError)
end
end
diff --git a/spec/ruby/core/array/shared/keep_if.rb b/spec/ruby/core/array/shared/keep_if.rb
index 906ad9b9e2..2f1299c2b3 100644
--- a/spec/ruby/core/array/shared/keep_if.rb
+++ b/spec/ruby/core/array/shared/keep_if.rb
@@ -37,23 +37,23 @@ describe :keep_if, shared: true do
describe "with truthy block" do
it "keeps elements after any exception" do
- lambda { @frozen.send(@method) { true } }.should raise_error(Exception)
+ -> { @frozen.send(@method) { true } }.should raise_error(Exception)
@frozen.should == @origin
end
it "raises a #{frozen_error_class}" do
- lambda { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
+ -> { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
end
end
describe "with falsy block" do
it "keeps elements after any exception" do
- lambda { @frozen.send(@method) { false } }.should raise_error(Exception)
+ -> { @frozen.send(@method) { false } }.should raise_error(Exception)
@frozen.should == @origin
end
it "raises a #{frozen_error_class}" do
- lambda { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
+ -> { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/array/shared/push.rb b/spec/ruby/core/array/shared/push.rb
index effa632890..df307073cd 100644
--- a/spec/ruby/core/array/shared/push.rb
+++ b/spec/ruby/core/array/shared/push.rb
@@ -27,7 +27,7 @@ describe :array_push, shared: true do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/replace.rb b/spec/ruby/core/array/shared/replace.rb
index b8dae8d33e..b3474fad09 100644
--- a/spec/ruby/core/array/shared/replace.rb
+++ b/spec/ruby/core/array/shared/replace.rb
@@ -53,7 +53,7 @@ describe :array_replace, shared: true do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda {
+ -> {
ArraySpecs.frozen_array.send(@method, ArraySpecs.frozen_array)
}.should raise_error(frozen_error_class)
end
diff --git a/spec/ruby/core/array/shared/slice.rb b/spec/ruby/core/array/shared/slice.rb
index b3f4ccb9a6..73456eb297 100644
--- a/spec/ruby/core/array/shared/slice.rb
+++ b/spec/ruby/core/array/shared/slice.rb
@@ -266,10 +266,10 @@ describe :array_slice, shared: true do
a.send(@method, 1..0).should == []
a.send(@method, 1...0).should == []
- lambda { a.send(@method, "a" .. "b") }.should raise_error(TypeError)
- lambda { a.send(@method, "a" ... "b") }.should raise_error(TypeError)
- lambda { a.send(@method, from .. "b") }.should raise_error(TypeError)
- lambda { a.send(@method, from ... "b") }.should raise_error(TypeError)
+ -> { a.send(@method, "a" .. "b") }.should raise_error(TypeError)
+ -> { a.send(@method, "a" ... "b") }.should raise_error(TypeError)
+ -> { a.send(@method, from .. "b") }.should raise_error(TypeError)
+ -> { a.send(@method, from ... "b") }.should raise_error(TypeError)
end
it "returns the same elements as [m..n] and [m...n] with Range subclasses" do
@@ -441,19 +441,19 @@ describe :array_slice, shared: true do
array = [1, 2, 3, 4, 5, 6]
obj = mock('large value')
obj.should_receive(:to_int).and_return(0x8000_0000_0000_0000_0000)
- lambda { array.send(@method, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, obj) }.should raise_error(RangeError)
obj = 8e19
- lambda { array.send(@method, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, obj) }.should raise_error(RangeError)
end
it "raises a RangeError when the length is out of range of Fixnum" do
array = [1, 2, 3, 4, 5, 6]
obj = mock('large value')
obj.should_receive(:to_int).and_return(0x8000_0000_0000_0000_0000)
- lambda { array.send(@method, 1, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, 1, obj) }.should raise_error(RangeError)
obj = 8e19
- lambda { array.send(@method, 1, obj) }.should raise_error(RangeError)
+ -> { array.send(@method, 1, obj) }.should raise_error(RangeError)
end
end
diff --git a/spec/ruby/core/array/shared/unshift.rb b/spec/ruby/core/array/shared/unshift.rb
index d7464cdaca..be62084e95 100644
--- a/spec/ruby/core/array/shared/unshift.rb
+++ b/spec/ruby/core/array/shared/unshift.rb
@@ -36,11 +36,11 @@ describe :array_unshift, shared: true do
end
it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
- lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shift_spec.rb b/spec/ruby/core/array/shift_spec.rb
index 26bce8aeb3..ef3c9fe1cd 100644
--- a/spec/ruby/core/array/shift_spec.rb
+++ b/spec/ruby/core/array/shift_spec.rb
@@ -31,10 +31,10 @@ describe "Array#shift" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.shift }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.shift }.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.shift }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.shift }.should raise_error(frozen_error_class)
end
describe "passed a number n as an argument" do
@@ -90,7 +90,7 @@ describe "Array#shift" do
end
it "raises an ArgumentError if n is negative" do
- lambda{ [1, 2, 3].shift(-1) }.should raise_error(ArgumentError)
+ ->{ [1, 2, 3].shift(-1) }.should raise_error(ArgumentError)
end
it "tries to convert n to an Integer using #to_int" do
@@ -105,12 +105,12 @@ describe "Array#shift" do
end
it "raises a TypeError when the passed n cannot be coerced to Integer" do
- lambda{ [1, 2].shift("cat") }.should raise_error(TypeError)
- lambda{ [1, 2].shift(nil) }.should raise_error(TypeError)
+ ->{ [1, 2].shift("cat") }.should raise_error(TypeError)
+ ->{ [1, 2].shift(nil) }.should raise_error(TypeError)
end
it "raises an ArgumentError if more arguments are passed" do
- lambda{ [1, 2].shift(1, 2) }.should raise_error(ArgumentError)
+ ->{ [1, 2].shift(1, 2) }.should raise_error(ArgumentError)
end
it "does not return subclass instances with Array subclass" do
diff --git a/spec/ruby/core/array/shuffle_spec.rb b/spec/ruby/core/array/shuffle_spec.rb
index 4f793acf19..7a2fed7d50 100644
--- a/spec/ruby/core/array/shuffle_spec.rb
+++ b/spec/ruby/core/array/shuffle_spec.rb
@@ -43,7 +43,7 @@ describe "Array#shuffle" do
it "raises a NoMethodError if an object passed for the RNG does not define #rand" do
obj = BasicObject.new
- lambda { [1, 2].shuffle(random: obj) }.should raise_error(NoMethodError)
+ -> { [1, 2].shuffle(random: obj) }.should raise_error(NoMethodError)
end
it "accepts a Float for the value returned by #rand" do
@@ -68,7 +68,7 @@ describe "Array#shuffle" do
random = mock("array_shuffle_random")
random.should_receive(:rand).and_return(value)
- lambda { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
end
it "raises a RangeError if the value is equal to one" do
@@ -77,7 +77,7 @@ describe "Array#shuffle" do
random = mock("array_shuffle_random")
random.should_receive(:rand).at_least(1).times.and_return(value)
- lambda { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
+ -> { [1, 2].shuffle(random: random) }.should raise_error(RangeError)
end
end
@@ -96,7 +96,7 @@ describe "Array#shuffle!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.shuffle! }.should raise_error(frozen_error_class)
- lambda { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.shuffle! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/slice_spec.rb b/spec/ruby/core/array/slice_spec.rb
index cd16b3892c..16220bdf0d 100644
--- a/spec/ruby/core/array/slice_spec.rb
+++ b/spec/ruby/core/array/slice_spec.rb
@@ -116,8 +116,8 @@ describe "Array#slice!" do
a.slice!(from .. to).should == [2, 3, 4]
a.should == [1, 5]
- lambda { a.slice!("a" .. "b") }.should raise_error(TypeError)
- lambda { a.slice!(from .. "b") }.should raise_error(TypeError)
+ -> { a.slice!("a" .. "b") }.should raise_error(TypeError)
+ -> { a.slice!(from .. "b") }.should raise_error(TypeError)
end
it "returns last element for consecutive calls at zero index" do
@@ -151,7 +151,7 @@ describe "Array#slice!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/sort_by_spec.rb b/spec/ruby/core/array/sort_by_spec.rb
index 6428194dfb..045051d307 100644
--- a/spec/ruby/core/array/sort_by_spec.rb
+++ b/spec/ruby/core/array/sort_by_spec.rb
@@ -24,11 +24,11 @@ describe "Array#sort_by!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
end
it "raises a #{frozen_error_class} on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
end
it "returns the specified value when it would break in the given block" do
diff --git a/spec/ruby/core/array/sort_spec.rb b/spec/ruby/core/array/sort_spec.rb
index c0d6628549..6b84a82a48 100644
--- a/spec/ruby/core/array/sort_spec.rb
+++ b/spec/ruby/core/array/sort_spec.rb
@@ -66,7 +66,7 @@ describe "Array#sort" do
it "does not deal with exceptions raised by unimplemented or incorrect #<=>" do
o = Object.new
- lambda {
+ -> {
[o, 1].sort
}.should raise_error(ArgumentError)
end
@@ -78,7 +78,7 @@ describe "Array#sort" do
end
it "raises an error when a given block returns nil" do
- lambda { [1, 2].sort {} }.should raise_error(ArgumentError)
+ -> { [1, 2].sort {} }.should raise_error(ArgumentError)
end
it "does not call #<=> on contained objects when invoked with a block" do
@@ -134,7 +134,7 @@ describe "Array#sort" do
a.sort { |n, m|
ArraySpecs::ComparableWithFixnum.new(n-m)
}.should == [-4, 1, 2, 5, 7, 10, 12]
- lambda {
+ -> {
a.sort { |n, m| (n - m).to_s }
}.should raise_error(ArgumentError)
end
@@ -155,7 +155,7 @@ describe "Array#sort" do
it "raises an error if objects can't be compared" do
a=[ArraySpecs::Uncomparable.new, ArraySpecs::Uncomparable.new]
- lambda {a.sort}.should raise_error(ArgumentError)
+ -> {a.sort}.should raise_error(ArgumentError)
end
# From a strange Rubinius bug
@@ -234,7 +234,7 @@ describe "Array#sort!" do
end
it "raises a #{frozen_error_class} on a frozen array" do
- lambda { ArraySpecs.frozen_array.sort! }.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.sort! }.should raise_error(frozen_error_class)
end
it "returns the specified value when it would break in the given block" do
diff --git a/spec/ruby/core/array/sum_spec.rb b/spec/ruby/core/array/sum_spec.rb
index a7e77d8c2e..39c769d328 100644
--- a/spec/ruby/core/array/sum_spec.rb
+++ b/spec/ruby/core/array/sum_spec.rb
@@ -26,11 +26,11 @@ describe "Array#sum" do
end
it 'raises TypeError if any element are not numeric' do
- lambda { ["a"].sum }.should raise_error(TypeError)
+ -> { ["a"].sum }.should raise_error(TypeError)
end
it 'raises TypeError if any element cannot be added to init value' do
- lambda { [1].sum([]) }.should raise_error(TypeError)
+ -> { [1].sum([]) }.should raise_error(TypeError)
end
it "calls + to sum the elements" do
diff --git a/spec/ruby/core/array/take_spec.rb b/spec/ruby/core/array/take_spec.rb
index 2c9e3f5cfe..0de99b0a7e 100644
--- a/spec/ruby/core/array/take_spec.rb
+++ b/spec/ruby/core/array/take_spec.rb
@@ -22,6 +22,6 @@ describe "Array#take" do
end
it "raises an ArgumentError when the argument is negative" do
- lambda{ [1].take(-3) }.should raise_error(ArgumentError)
+ ->{ [1].take(-3) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/array/to_h_spec.rb b/spec/ruby/core/array/to_h_spec.rb
index 4431430216..46a79ba58b 100644
--- a/spec/ruby/core/array/to_h_spec.rb
+++ b/spec/ruby/core/array/to_h_spec.rb
@@ -24,15 +24,15 @@ describe "Array#to_h" do
end
it "raises TypeError if an element is not an array" do
- lambda { [:x].to_h }.should raise_error(TypeError)
+ -> { [:x].to_h }.should raise_error(TypeError)
end
it "raises ArgumentError if an element is not a [key, value] pair" do
- lambda { [[:x]].to_h }.should raise_error(ArgumentError)
+ -> { [[:x]].to_h }.should raise_error(ArgumentError)
end
it "does not accept arguments" do
- lambda { [].to_h(:a, :b) }.should raise_error(ArgumentError)
+ -> { [].to_h(:a, :b) }.should raise_error(ArgumentError)
end
it "produces a hash that returns nil for a missing element" do
diff --git a/spec/ruby/core/array/transpose_spec.rb b/spec/ruby/core/array/transpose_spec.rb
index c7bd7e7338..b39077f4c9 100644
--- a/spec/ruby/core/array/transpose_spec.rb
+++ b/spec/ruby/core/array/transpose_spec.rb
@@ -32,7 +32,7 @@ describe "Array#transpose" do
end
it "raises a TypeError if the passed Argument does not respond to #to_ary" do
- lambda { [Object.new, [:a, :b]].transpose }.should raise_error(TypeError)
+ -> { [Object.new, [:a, :b]].transpose }.should raise_error(TypeError)
end
it "does not call to_ary on array subclass elements" do
@@ -41,7 +41,7 @@ describe "Array#transpose" do
end
it "raises an IndexError if the arrays are not of the same length" do
- lambda { [[1, 2], [:a]].transpose }.should raise_error(IndexError)
+ -> { [[1, 2], [:a]].transpose }.should raise_error(IndexError)
end
it "does not return subclass instance on Array subclasses" do
diff --git a/spec/ruby/core/array/try_convert_spec.rb b/spec/ruby/core/array/try_convert_spec.rb
index 5f653b6807..47b4722d80 100644
--- a/spec/ruby/core/array/try_convert_spec.rb
+++ b/spec/ruby/core/array/try_convert_spec.rb
@@ -39,12 +39,12 @@ describe "Array.try_convert" do
it "sends #to_ary to the argument and raises TypeError if it's not a kind of Array" do
obj = mock("to_ary")
obj.should_receive(:to_ary).and_return(Object.new)
- lambda { Array.try_convert obj }.should raise_error(TypeError)
+ -> { Array.try_convert obj }.should raise_error(TypeError)
end
it "does not rescue exceptions raised by #to_ary" do
obj = mock("to_ary")
obj.should_receive(:to_ary).and_raise(RuntimeError)
- lambda { Array.try_convert obj }.should raise_error(RuntimeError)
+ -> { Array.try_convert obj }.should raise_error(RuntimeError)
end
end
diff --git a/spec/ruby/core/array/uniq_spec.rb b/spec/ruby/core/array/uniq_spec.rb
index 471717b8e2..c9bdd3dacd 100644
--- a/spec/ruby/core/array/uniq_spec.rb
+++ b/spec/ruby/core/array/uniq_spec.rb
@@ -191,17 +191,17 @@ describe "Array#uniq!" do
it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
dup_ary = [1, 1, 2]
dup_ary.freeze
- lambda { dup_ary.uniq! }.should raise_error(frozen_error_class)
+ -> { dup_ary.uniq! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(frozen_error_class)
- lambda { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.uniq!}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(frozen_error_class)
end
it "doesn't yield to the block on a frozen array" do
- lambda { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(frozen_error_class)
+ -> { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(frozen_error_class)
end
it "compares elements based on the value returned from the block" do