Commit 0810358a by vulehuan

rspec: product - paging

parent f2eb7965
...@@ -6,56 +6,58 @@ describe "Products Page" do ...@@ -6,56 +6,58 @@ describe "Products Page" do
describe "product page" do describe "product page" do
describe "list" do
before { visit products_path } before { visit products_path }
describe "list" do
it { should have_content('Products') } it { should have_content('Products') }
it { should have_title(full_title('Products')) } it { should have_title(full_title('Products')) }
end end
# describe "pagination" do describe "pagination" do
# before(:all) { before(:all) {
# @product_category = ProductCategory.new( @product_category = ProductCategory.new(
# name: "Product category name" name: "Product category name"
# ) )
# @product_category.save @product_category.save
# @user = User.new(name: "Example User", email: "user_product_test@example.com", password: "foobar", password_confirmation: "foobar") @user = User.new(name: "Example User", email: "user_product_test@example.com", password: "foobar", password_confirmation: "foobar")
# @user.save @user.save
# 300.times do |n| 99.times do |n|
# @product = Product.new( @product = Product.new(
# name: "Example #{n} User", name: "Example #{n} User",
# description: "user@example.com", description: "user@example.com",
# headline: "foobar", headline: "foobar",
# availability: "foobar", availability: "instock",
# code: 'Code', code: 'Code',
# condition: 'Condition', condition: 'Condition',
# image_small: '', image_small: '',
# image_medium: 'Image Path', image_medium: 'Image Path',
# review_rate: 0, review_rate: 0,
# review_count: 0, review_count: 0,
# price_currency: 'USD', price_currency: 'USD',
# price: 0, price: 0,
# product_category_id: @product_category.id, product_category_id: @product_category.id,
# user_id: @user.id, user_id: @user.id,
# status: 1 status: true
# ) )
# @product.save @product.save
# end end
}
# visit products_path after(:all) do
# } Product.delete_all
# after(:all) do User.delete_all
# Product.delete_all ProductCategory.delete_all
# User.delete_all end
# ProductCategory.delete_all
# end describe "should list each product" do
Product.paginate(page: 1).each do |product|
# it "should list each product" do it { should have_selector('.grid-view .item h4 a', text: product.name) }
# Product.paginate(page: 1).each do |product| end
# expect(page).to have_selector('.item h4 a') end
# end
# end describe "should have paging" do
# end it { should have_selector('.pagination li') }
end
end
end end
describe "category page" do describe "category page" do
...@@ -106,7 +108,7 @@ describe "Products Page" do ...@@ -106,7 +108,7 @@ describe "Products Page" do
name: "Example User", name: "Example User",
description: "user@example.com", description: "user@example.com",
headline: "foobar", headline: "foobar",
availability: "foobar", availability: "instock",
code: 'Code', code: 'Code',
condition: 'Condition', condition: 'Condition',
image_small: '', image_small: '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment