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'
end
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}"
end
end
Then in my view:
%ul
- @products.each do |product|
%ul
%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?
Thanks