Permalink
Browse files

Fix brittle products spec test

Only check that there are two products on first page, one on second. It's not important what their names are, only the counts
  • Loading branch information...
1 parent 2695235 commit bc88123605eef82d0466fa5f5434da97e03359c0 @radar radar committed May 26, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 core/spec/requests/products_spec.rb
@@ -113,13 +113,12 @@
within(:css, '#sidebar_products_search') { click_button "Search" }
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 Mug", "Ruby on Rails Tote"]
+ products = page.all('ul.product-listing li a[itemprop=name]')
+ products.count.should == 2
+
find('nav.pagination .next a').click
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
- tmp.delete("")
- tmp.sort!.should == ["Ruby on Rails Stein"]
+ products = page.all('ul.product-listing li a[itemprop=name]')
+ products.count.should == 1
end
it "should be able to display products priced 18 dollars and above" do

0 comments on commit bc88123

Please sign in to comment.