diff options
Diffstat (limited to 'spec/support/factory_orders.rb')
-rw-r--r-- | spec/support/factory_orders.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/support/factory_orders.rb b/spec/support/factory_orders.rb index 76c0d63..d02249a 100644 --- a/spec/support/factory_orders.rb +++ b/spec/support/factory_orders.rb @@ -11,25 +11,25 @@ def recruit_with_answered_and_unanswered_questions(n=5) r.unanswered = [] for i in 1..n # answered and unanswered ungrouped questions - category = Factory(:question_category) - r.answered.push Factory(:question, :question_category => category) - r.unanswered.push Factory(:question, :question_category => category) + category = Factory(:category) + r.answered.push Factory(:question, :category => category) + r.unanswered.push Factory(:question, :category => category) Factory(:answer, :owner => r.recruit, :question => r.answered.last) # and answered and unanswered question in one group group = Factory(:question_group) - r.answered.push Factory(:question, :question_category => category, :question_group => group) + r.answered.push Factory(:question, :category => category, :question_group => group) Factory(:user_question_group, :user => r.recruit, :question => r.answered.last) # This question isn't unanswered! This is question user can't answer - Factory(:question, :question_category => category, :question_group => group) + Factory(:question, :category => category, :question_group => group) # add a unanswered grouped question - r.unanswered.push Factory(:question, :question_category => category, :question_group => Factory(:question_group)) + r.unanswered.push Factory(:question, :category => category, :question_group => Factory(:question_group)) Factory(:user_question_group, :user => r.recruit, :question => r.unanswered.last) Factory(:answer, :owner => r.recruit, :question => r.answered.last) - r.recruit.question_categories.push category + r.recruit.categories.push category end r end @@ -48,17 +48,17 @@ def recruit_with_answers_in_categories(mentor = nil, n_categories = 5, n_ans_in_ r.answers_in_cat = [] r.all_answers = [] for i in 1..n_categories - r.categories.push Factory(:question_category) + r.categories.push Factory(:category) r.answers_in_cat.push [] for i in 1..n_ans_in_cat - question = Factory(:question, :question_category => r.categories.last) + question = Factory(:question, :category => r.categories.last) r.all_answers.push Factory(:answer, :owner => r.recruit, :question => question) r.answers_in_cat.last.push r.all_answers.last # group of two questions, answered group = Factory(:question_group) - question = Factory(:question, :question_category => r.categories.last, :question_group => group) - Factory(:question, :question_category => r.categories.last, :question_group => group) + question = Factory(:question, :category => r.categories.last, :question_group => group) + Factory(:question, :category => r.categories.last, :question_group => group) Factory(:user_question_group, :user => r.recruit, :question => question) r.all_answers.push Factory(:answer, :owner => r.recruit, :question => question) r.answers_in_cat.last.push r.all_answers.last |