Created
March 5, 2015 14:46
-
-
Save gmacdougall/dbbe2cd68ff9d587c131 to your computer and use it in GitHub Desktop.
Giant Spree Dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shipping_category = Spree::ShippingCategory.create! name: 'default' | |
20.times { |i| Spree::StockLocation.create! name: i.to_s } | |
ActiveRecord::Base.no_touching do | |
10_000.times do | |
product = Spree::Product.create! name: SecureRandom.hex, price: 20, shipping_category: shipping_category | |
rand(1..10).times do | |
variant = Spree::Variant.create! product: product | |
variant.stock_items.shuffle.first(rand(1..20)).each { |stock_item| stock_item.update_columns(count_on_hand: rand(1..1000)) } | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment