Skip to content

Commit b833642

Browse files
herwinweregon
authored andcommitted
Match error messages in specs of Array#fetch
These were matched in the specs of Array#fetch_values, they have been added here for consistency and to make it easier to implement Array#fetch_values as a map over Array#fetch.
1 parent 27f204a commit b833642

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

core/array/fetch_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
end
1313

1414
it "raises an IndexError if there is no element at index" do
15-
-> { [1, 2, 3].fetch(3) }.should raise_error(IndexError)
16-
-> { [1, 2, 3].fetch(-4) }.should raise_error(IndexError)
17-
-> { [].fetch(0) }.should raise_error(IndexError)
15+
-> { [1, 2, 3].fetch(3) }.should raise_error(IndexError, "index 3 outside of array bounds: -3...3")
16+
-> { [1, 2, 3].fetch(-4) }.should raise_error(IndexError, "index -4 outside of array bounds: -3...3")
17+
-> { [].fetch(0) }.should raise_error(IndexError, "index 0 outside of array bounds: 0...0")
1818
end
1919

2020
it "returns default if there is no element at index if passed a default value" do
@@ -50,6 +50,6 @@ def o.to_int(); 5; end
5050
end
5151

5252
it "raises a TypeError when the passed argument can't be coerced to Integer" do
53-
-> { [].fetch("cat") }.should raise_error(TypeError)
53+
-> { [].fetch("cat") }.should raise_error(TypeError, "no implicit conversion of String into Integer")
5454
end
5555
end

0 commit comments

Comments
 (0)