This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "ProductPage", :type => :feature do | |
include ActionView::Helpers::UrlHelper | |
include ActionView::Helpers::AssetTagHelper | |
before do | |
@product = Spree::Product.last | |
visit "/products/#{@product.permalink}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Assign @similar_products the same way as view file | |
@similar_taxon = @product.taxons.first | |
@similar_products = (@product.similar_products.length > 0) ? @product.similar_products.first(3) : Spree::Product.in_taxon(@similar_taxon).limit(3) | |
if @similar_products.length >= 3 | |
#Display a similar products container div, only if there are 3 similar products | |
page.should have_selector(".title-bar h4", :content => "Similar Products") | |
#Anything else that doesn't need to be looped goes here... | |
#In a loop, check for the divs corresponding to each similar product | |
@similar_products.each do |sp| |