Created
February 7, 2013 18:17
-
-
Save johnbayne/4732950 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
factory :project do | |
sequence(:name) { |n| "Test Factory #{n}" } | |
# I'd prefer to do something like this, with 'active' set to true | |
# steps { |s| [s.association(:step)] } | |
active false | |
association :project_group | |
project_type 'Delivery' | |
delimiter ';' | |
ignore { question_count 2 } | |
after(:create) do |project, evaluator| | |
create_list(:textfield_question, evaluator.question_count, project: project) | |
# Instead of this, which is clumsy & requires an extra hit to the database | |
project.steps << FactoryGirl.create(:step, project: project) | |
project.active = true | |
project.save! | |
end | |
end | |
FactoryGirl.define do | |
factory :step do | |
sequence(:name) { |n| "Test Step #{n}" } | |
sequence(:ordinal) { |n| n } | |
gold_threshold 10 | |
association :project | |
gold_size_in_burst 5 | |
prod_size_in_burst 5 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment