Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/array/fetch_values_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

describe "with unmatched indexes" do
it "raises a index error if no block is provided" do
-> { @array.fetch_values(0, 1, 44) }.should raise_error(IndexError)
-> { @array.fetch_values(0, 1, 44) }.should raise_error(IndexError, "index 44 outside of array bounds: -3...3")
end

it "returns the default value from block" do
Expand All @@ -42,8 +42,14 @@
@array.fetch_values(obj).should == [:c]
end

it "does not support a Range object as argument" do
-> {
@array.fetch_values(1..2)
}.should raise_error(TypeError, "no implicit conversion of Range into Integer")
end

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