Integration test not passing even though site works in browser

I have the following integration test:

require 'spec_helper'

feature 'View the store' do
  scenario 'user sees relevant information' do
    visit root_path
    expect(page).to have_css 'title', text: 'StoreEngine'

  scenario 'user sees all products' do
    visit root_path
    product = Product.create(title: 'T-Shirt', description: 'Brand new red t-shirt', price: 7.99)
    expect(page).to have_css 'li', text: "Description: #{product.description}"

Then in my view:

  - @products.each do |product|
      %li= "Title: #{product.title}"
      %li= "Description: #{product.description}"
      %li= "Price: #{product.price}"

I get this failure:

1) View the store user sees all products
     Failure/Error: expect(page).to have_css 'li', text: "Description: #{product.description}"
       expected css "li" with text "Description: Brand new red t-shirt" to return something

I’ve created the product model, run migrations and prepared the test db. I’m not sure what I’m missing here, can someone help?


SOLVED: I had the order of creating the Product and visit root_path incorrect. Product should be created before visiting root_path. Thought I tried this and it failed…but I guess I didn’t.