Rubyとか意味がわからない
assert_equal sales[:pcount], checkouts.inject(0) do |acc, checkout| if checkout.price >= 0 acc + 1 else acc end end
これがエラーになって悩んだ。
正しくは、
assert_equal sales[:pcount], (checkouts.inject(0) do |acc, checkout| if checkout.price >= 0 acc + 1 else acc end end)