The code for the shown test (in file …/controllers/orders_controller_test.rb
) is:
test "requires item in cart" do
get new_order_url
assert_redirected_to store_index_path
assert_equal flash[:notice], 'Your cart is empty'
end
The Minitest ri
info says (or check module Minitest::Assertions - minitest-5.16.3 Documentation):
= .assert_equal
(from gem minitest-5.15.0)
=== Implementation from Assertions
------------------------------------------------------------------------
assert_equal(exp, act, msg = nil)
------------------------------------------------------------------------
Fails unless exp == act printing the difference between the two, if
possible.
…
So, it should be:
assert_equal 'Your cart is empty', flash[:notice]
(Otherwise, if/when the assertion fails, the error message would be a bit confusing.