From eeefe2522757aceed90d9728f6534a8d42db7f21 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sun, 3 Nov 2013 13:58:26 -0500 Subject: [PATCH] Make sure grabbing valid ID, better faking --- spec/factories/bikes.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/factories/bikes.rb b/spec/factories/bikes.rb index 0151534..e2f04ea 100644 --- a/spec/factories/bikes.rb +++ b/spec/factories/bikes.rb @@ -6,15 +6,15 @@ FactoryGirl.define do sequence :serial_number do |n| "#{Faker::Code.isbn}-#{n}" end - bike_brand_id { Random.rand(100) } + bike_brand_id { BikeBrand.all.sample.id } model { Faker::Commerce.product_name } color { sprintf("%06X", Random.rand(16777215) ) } - bike_style_id { Random.rand(2) } + bike_style_id { BikeStyle.all.sample.id } seat_tube_height { Random.rand(25) } top_tube_length { Random.rand(25) } - bike_wheel_size_id { Random.rand(10) } + bike_wheel_size_id { BikeWheelSize.all.sample.id } value { Random.rand(200) } - bike_condition_id { Random.rand(2) } - bike_purpose_id { Random.rand(2) } + bike_condition_id { BikeCondition.all.sample.id } + bike_purpose_id { BikePurpose.all.sample.id } end end