Open ivalentine opened 7 years ago
@pajamaw and I just ran into this issue, and discovered the reason was that my view was rendering
p1 = Product.create!(name: "Test Product", ... , price: "2.99")
p2 = Product.create!(name: "Test Product 2", ... )
with
<h1><%= @product.name %></h1>
<li><%= @product.price %></li>
as
page.text
#=> Test Product 2 ... (the name and price of p1)
Which happens to be the name
of p2
, which the test is expecting the page not_to
have.
Removing or simply moving the price in the view fixed this issue. e.g.
<h1><%= @product.name %></h1>
<li><%= @product.inventory %></li>
<li><%= @product.price %></li>
Suggested fix: change p2
to
p2 = Product.create!(name: "Test Product Two", ... )
I was helping @jd2rogers2 with this lab, and we seem to have discovered an issue: the first test in
product_feature_spec.rb
doesn't work. Here's the test:James and I both tested his code by opening the first product page in the browser, disabling JavaScript, and clicking the "Next Product" link. As expected, nothing happened, but the test is still failing.
This issue appears to be the same as learn-co-curriculum/using-active-model-serializer-lab#3.