diff --git a/spec/factories/contest.rb b/spec/factories/contest.rb new file mode 100755 index 0000000..98695b2 --- /dev/null +++ b/spec/factories/contest.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :contest do + sequence(:name) { |n| "Contest ##{n}" } + + start Date.yesterday + self.end Date.tomorrow + status Contest::STATUS_PROGRESS + default_time "12:00:00" + end +end diff --git a/spec/factories/contester.rb b/spec/factories/contester.rb new file mode 100755 index 0000000..fe87ae7 --- /dev/null +++ b/spec/factories/contester.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :contester do + contest + team do + create(:user_with_team).team + end + end +end diff --git a/spec/factories/group.rb b/spec/factories/group.rb old mode 100644 new mode 100755 index 68cec21..d0f0742 --- a/spec/factories/group.rb +++ b/spec/factories/group.rb @@ -1,27 +1,39 @@ FactoryGirl.define do factory :group do - sequence(:id) { |n| n + 100 } # Preserve first 100 + sequence(:id) { |n| n + 100 } # Preserve first 100 sequence(:name) { |n| "Group#{n}" } association :founder, factory: :user + + initialize_with { Group.find_or_create_by_id(id) } end trait :admin do - name "Admins" - id Group::ADMINS + name "Admins" + id Group::ADMINS + end + + trait :caster do + name "Shoutcasters" + id Group::CASTERS end trait :champions do - name "Champions" - id Group::CHAMPIONS + name "Champions" + id Group::CHAMPIONS end trait :donors do - name "Donors" - id Group::DONORS + name "Donors" + id Group::DONORS end trait :gather_moderator do name "Gather Moderator" id Group::GATHER_MODERATORS end + + trait :ref do + name "Referees" + id Group::REFEREES + end end diff --git a/spec/factories/match.rb b/spec/factories/match.rb new file mode 100755 index 0000000..be17db9 --- /dev/null +++ b/spec/factories/match.rb @@ -0,0 +1,13 @@ +FactoryGirl.define do + factory :match do + contest + contester1 do + create(:contester, contest: contest) + end + contester2 do + create(:contester, contest: contest) + end + + match_time 1.hour.from_now + end +end diff --git a/spec/factories/user.rb b/spec/factories/user.rb old mode 100644 new mode 100755 index 74942ac..2cf98a7 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -20,6 +20,20 @@ FactoryGirl.define do end end + trait :caster do + after(:create) do |user| + group = create(:group, :caster) + create :grouper, user: user, group: group + end + end + + trait :ref do + after(:create) do |user| + group = create(:group, :ref) + create :grouper, user: user, group: group + end + end + trait :chris do steamid "0:1:58097444" end