summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array/element_set_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/array/element_set_spec.rb')
-rw-r--r--spec/ruby/core/array/element_set_spec.rb48
1 files changed, 24 insertions, 24 deletions
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