I have implemented one of the ‘Playtime’ exercises that adds a button to the line_items in the cart, to decrement the item’s count when clicked. (and remove the line item when decremented to zero)
Examining the logs informed me that when the button was pushed, I was being redirected to “login” (with a GET) as JS. It “rendered” the logon screen, but since it was JS, the page did not change. The solution here is that the LineItemController should have “:destroy” added to the skip_before_filter.
But, why didn’t the functional tests detect this? The line_item_controller_test does a should_destroy_line_item test, but since the test setup function logs in for ALL controllers, the test succeeded in deleting the line item, and passed.
So, I can fix the functional issue by adding :destroy to the before filter, but how do I manage the tests such that it would discover this problem? It would seem I’d need to have the tests perform the setup/login only for the appropriate tests, not for a blanket “if defined: session” conditional.