Commit a56dcc0a1e494bbfcd49491ae23872cf39523a8c

Authored by Joenio Costa
1 parent c1fc0260

Fixing script/sample-products

- Product category is mandatory for products now
Showing 1 changed file with 7 additions and 3 deletions   Show diff stats
script/sample-products
... ... @@ -7,6 +7,7 @@ include ActionController::TestProcess
7 7 STDOUT.sync = true
8 8  
9 9 enterprises = Enterprise.all
  10 +categories = ProductCategory.all
10 11  
11 12 print "Creating products: "
12 13 THINGS = %w[ Car House Bicycle Book Pen Computer Webcam ]
... ... @@ -15,9 +16,12 @@ for thing in THINGS
15 16 for color in COLORS
16 17 name = [color, thing].join(' ')
17 18 rand(10).times do |i|
18   - Product.create(:name => name, :enterprise_id => enterprises.rand.id, :price => (i * 13.7), :image_builder => {
19   - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')
20   - })
  19 + Product.create(
  20 + :name => name,
  21 + :enterprise_id => enterprises.rand.id, :price => (i * 13.7),
  22 + :product_category => categories.rand,
  23 + :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') }
  24 + )
21 25 print '.'
22 26 end
23 27 end
... ...