Skip to content

Commit

Permalink
Correct products spec to have three products so that pagination is en…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
radar committed May 29, 2012
1 parent 209aefc commit ba8eec9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions core/spec/requests/products_spec.rb
Expand Up @@ -100,10 +100,10 @@
check "Price_Range_$15.00_-_$18.00"
within(:css, '#sidebar_products_search') { click_button "Search" }

page.all('ul.product-listing li').size.should == 2
page.all('ul.product-listing li').size.should == 3
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
tmp.delete("")
tmp.sort!.should == ["Ruby on Rails Ringer T-Shirt", "Ruby on Rails Stein", "Ruby on Rails Tote"]
tmp.sort!.should == ["Ruby on Rails Mug", "Ruby on Rails Stein", "Ruby on Rails Tote"]
end

it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
Expand All @@ -112,10 +112,10 @@
check "Price_Range_$15.00_-_$18.00"
within(:css, '#sidebar_products_search') { click_button "Search" }

page.all('ul.product-listing li').size.should == 4
page.all('ul.product-listing li').size.should == 2
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
tmp.delete("")
tmp.sort!.should == ["Ruby on Rails Ringer T-Shirt", "Ruby on Rails Tote"]
tmp.sort!.should == ["Ruby on Rails Mug", "Ruby on Rails Tote"]
find('nav.pagination .next a').click
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
tmp.delete("")
Expand All @@ -128,11 +128,12 @@
check "Price_Range_$20.00_or_over"
within(:css, '#sidebar_products_search') { click_button "Search" }

page.all('ul.product-listing li').size.should == 3
page.all('ul.product-listing li').size.should == 4
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
tmp.delete("")
tmp.sort!.should == ["Ruby on Rails Bag",
"Ruby on Rails Baseball Jersey",
"Ruby on Rails Jr. Spaghetti"]
"Ruby on Rails Jr. Spaghetti",
"Ruby on Rails Ringer T-Shirt"]
end
end
2 changes: 1 addition & 1 deletion core/spec/spec_helper.rb
Expand Up @@ -76,7 +76,7 @@
ruby_taxon = FactoryGirl.create(:taxon, :name => 'Ruby', :parent_id => root.id)

FactoryGirl.create(:custom_product, :name => 'Ruby on Rails Ringer T-Shirt', :price => '19.99', :taxons => [rails_taxon, clothing_taxon])
FactoryGirl.create(:custom_product, :name => 'Ruby on Rails Mug', :price => '13.99', :taxons => [rails_taxon, mugs_taxon])
FactoryGirl.create(:custom_product, :name => 'Ruby on Rails Mug', :price => '15.99', :taxons => [rails_taxon, mugs_taxon])
FactoryGirl.create(:custom_product, :name => 'Ruby on Rails Tote', :price => '15.99', :taxons => [rails_taxon, bags_taxon])
FactoryGirl.create(:custom_product, :name => 'Ruby on Rails Bag', :price => '22.99', :taxons => [rails_taxon, bags_taxon])
FactoryGirl.create(:custom_product, :name => 'Ruby on Rails Baseball Jersey', :price => '19.99', :taxons => [rails_taxon, clothing_taxon])
Expand Down

0 comments on commit ba8eec9

Please sign in to comment.