Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FactoryGirl.define do | ||
%w[team manager division league].each do |type| | ||
sequence :"#{type}_name" do |n| | ||
"#{type.capitalize} #{n}" | ||
end | ||
end | ||
|
||
|
||
factory :team do | ||
league_id rand(99999) | ||
division_id rand(99999) | ||
name Factory.next(:team_name) | ||
manager Factory.next(:manager_name) | ||
founded 1869 + rand(130) | ||
wins (wins = rand(163)) | ||
losses 162 - wins | ||
win_percentage ("%.3f" % (wins.to_f / 162).to_f) | ||
end | ||
|
||
factory :league do | ||
name Factory.next(:league_name) | ||
end | ||
|
||
factory :division do | ||
name Factory.next(:division_name) | ||
association :league | ||
end | ||
end |
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