Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #167 from 18F/seed-uses-factory-girl
Browse files Browse the repository at this point in the history
Use factory_girl in the db:seed task
  • Loading branch information
adelevie committed Dec 30, 2015
2 parents 6fae210 + e30fbd6 commit 03c71ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)

auction = Auction.new({
FactoryGirl.create(
:current_auction,
issue_url: 'https://github.com/18F/mpt3500/issues/10',
start_price: 3500.0,
start_datetime: Chronic.parse("October 13 2015 at 2:15 PM"),
end_datetime: Chronic.parse("October 14 2015 at 3:00 PM"),
title: 'Build a Placeholder for MPT 3500',
description: 'This auction is a placeholder for MPT 3500. The MPT 3500 team needs to build the following ...',
github_repo: 'https://github.com/18F/mpt3500',
published: 0
})
auction.save
github_repo: 'https://github.com/18F/mpt3500')
4 changes: 2 additions & 2 deletions spec/factories/auctions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

trait :with_bidders do
after(:build) do |instance|
(1..4).each do |i|
amount = 3499 - (20 * i) - rand(10)
(1..rand(10)+1).each do |i|
amount = 3499 - (100 * i) - rand(30)
instance.bids << FactoryGirl.create(:bid, auction: instance, amount: amount)
end
end
Expand Down

0 comments on commit 03c71ed

Please sign in to comment.