small medium large xlarge

Image_pragsmall
03 Aug 2016, 11:07
ShangYo Chen (3 posts)

From the book (pdf) p.165, the code snippet in test/controllers/line_items_controller_test.rb:

assert_select_jquery :html, '#cart' do
   assert_select 'tr#current_item td', /Programming Ruby 1.9/
end

fails:

No JQuery call matches [:html, "#cart"]

According to what I’ve googled, it has something to do with jquery-rails. However, the issue seems exists for a long time. (https://github.com/rails/jquery-rails/issues/188)

I wonder why it’s not fixed.

Samr_small_pragsmall
08 Aug 2016, 15:10
Sam Ruby (634 posts)

The test passes for me: http://intertwingly.net/projects/AWDwR4/checkdepot-50/section-11.3.html#cmd7

Care to provide a link to what you saw from on the web?

Image_pragsmall
16 Aug 2016, 09:22
ShangYo Chen (3 posts)

My problem solved in a mysterious way:

I found out that I forgot to add ; for jQuery statement in app/views/line_items/create.js.erb.

When I add them back, the test passes.

Wonder why this would happen. I thought ; in js is not mandatory.

You must be logged in to comment