Skip to content

Commit

Permalink
Fixed a bug with product and category product layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Austen Ito committed Apr 19, 2012
1 parent 141601a commit b28f380
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/controllers/categories_products_controller.rb
Expand Up @@ -8,5 +8,9 @@ def index
rows.times do |i|
@product_rows << products.pop(5)
end

if rows == 0 && products.length > 0
@product_rows << products
end
end
end
4 changes: 4 additions & 0 deletions app/controllers/products_controller.rb
Expand Up @@ -9,6 +9,10 @@ def index
rows.times do |i|
@product_rows << products.pop(5)
end

if rows == 0 && products.length > 0
@product_rows << products
end
end

def new
Expand Down
7 changes: 4 additions & 3 deletions spec/requests/products_requests_spec.rb
@@ -1,9 +1,10 @@
require 'spec_helper'

describe "Products Requests" do
describe "Products Requests", :model => :product do
context "when I view all products" do
let!(:products) { [Fabricate(:product, :title => "Foo"),
Fabricate(:product, :title => "Bar")] }
let!(:product) { Fabricate(:product, :title => "Foo") }
let!(:product2) { Fabricate(:product, :title => "Bar") }

before(:each) do
visit products_path
end
Expand Down

0 comments on commit b28f380

Please sign in to comment.