small medium large xlarge

Generic-user-small
21 Sep 2016, 16:21
Andrew Merritt (1 post)

After removing cart_id from thie list of parameters in app/controllers/line_items_controller.rb we run controller tests. On this test I’m receiving the error message:

LineItemsControllerTest#test_should_create_line_item [/Users/andrewmerritt/Documents/Ruby Programs/Work/depot/test/controllers/line_items_controller_test.rb:26]:
<1 × Programming Ruby 1.9> expected but was
<Home>..

It looks like the test line from test/controllers/line_item_controller_test.rb

assert_select 'li', "1 \u00D7 Programming Ruby 1.9"

is testing the li element from the views/layouts/application.html.erb instead of what should be displayed from the views/carts/show.html.erb file.

Can anyone point me to a fix for this?

Perso2-smaller_pragsmall
18 Oct 2016, 02:02
JS Bournival (5 posts)

assert_select '#main li', '1 \u00D7 Programming Ruby 1.9'

This will narrow the selector down to the main div

Generic-user-small
08 Sep 2017, 17:26
Alan Elliott (1 post)

For me, I got the error when I used single quotes instead of double quotes in the assert_select statement.

“1 \u00D7 Programming Ruby 1.9” works

‘1 \u00D7 Programming Ruby 1.9’ does not.

You must be logged in to comment