Skip to content

Commit

Permalink
Add test to existing method
Browse files Browse the repository at this point in the history
  • Loading branch information
mnoack committed May 17, 2018
1 parent 093f9db commit ebab172
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/array_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def stringify_values_recursively
expect([1, 2, 3].hash_by { |k| k * 2 }).to eq({ 2 => 1, 4 => 2, 6 => 3 })
end

it "#hash_by_id" do
one = double(id: 1, name: 'One')
two = double(id: 2, name: 'Two')
expect([one, two].hash_by_id).to eq(1 => one, 2 => two)
end

it "should allow executing blocks recursively" do
array = [1, [2, 3], [4, [5, 6], 7, [8]], 9, [[10]]]
result = []
Expand Down

0 comments on commit ebab172

Please sign in to comment.