diff options
author | Petteri Räty <betelgeuse@gentoo.org> | 2011-03-12 21:13:18 +0200 |
---|---|---|
committer | Petteri Räty <betelgeuse@gentoo.org> | 2011-03-12 21:13:18 +0200 |
commit | c38161f8d317aee036f197a9b670f96dcd4c9ec3 (patch) | |
tree | 3ba7b4cd90a3bb5ea4a351c3c3221fd8de8603fd /spec/models/question_spec.rb | |
parent | Rename QuestionCategory to Category (diff) | |
download | recruiting-webapp-c38161f8d317aee036f197a9b670f96dcd4c9ec3.tar.gz recruiting-webapp-c38161f8d317aee036f197a9b670f96dcd4c9ec3.tar.bz2 recruiting-webapp-c38161f8d317aee036f197a9b670f96dcd4c9ec3.zip |
Questions can belong to many categories
While starting to input quiz questions for the arch tester quizzes we
found out that it would be best if questions could belong to many
categories. Now the relationship between questions and categories is
many to many. Bug #356179.
Diffstat (limited to 'spec/models/question_spec.rb')
-rw-r--r-- | spec/models/question_spec.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb index 5dddd70..99a286f 100644 --- a/spec/models/question_spec.rb +++ b/spec/models/question_spec.rb @@ -68,8 +68,8 @@ describe Question do it "should send email notifications to watching recruits when created by recruiter" do category = Factory(:category) recruit = Factory(:recruit, :categories => [category]) - question = Question.new(:title => "new question", - :category => category) + question = Factory.build(:question) + question.categories << category UserMailer.should_receive_delayed(:deliver_new_question, recruit, question) @@ -79,19 +79,19 @@ describe Question do it "should send email notifications to watching recruits when approved" do category = Factory(:category) recruit = Factory(:recruit, :categories => [category]) - question = Factory(:question, :title => "new question", - :category => category, :user => Factory(:recruit)) + question = Factory(:question, :user => Factory(:recruit)) + question.categories << category UserMailer.should_receive_delayed(:deliver_new_question, recruit, question) question.approved = true question.save! end - it "should not send email notifications to watching recruits when approved is changed" do + it "should not send email notifications to watching recruits when approved is not changed" do category = Factory(:category) recruit = Factory(:recruit, :categories => [category]) - question = Factory(:question, :title => "new question", - :category => category, :user => Factory(:recruit), :approved => true) + question = Factory(:question, :user => Factory(:recruit), :approved => true) + question.categories << category UserMailer.should_not_receive(:deliver_new_question).with(recruit, question) @@ -146,7 +146,6 @@ describe Question do question.should be_editable_by(recruit) question.should be_editable_by(recruit, :title) question.should be_editable_by(recruit, :documentation) - question.should be_editable_by(recruit, :category) question.should_not be_editable_by(recruit, :user) question.should_not be_editable_by(recruit, :approved) @@ -159,7 +158,6 @@ describe Question do question.should be_editable_by(recruit) question.should be_editable_by(recruit, :title) question.should be_editable_by(recruit, :documentation) - question.should be_editable_by(recruit, :category) question.should_not be_editable_by(recruit, :user) question.should_not be_editable_by(recruit, :approved) @@ -172,7 +170,6 @@ describe Question do question.should be_editable_by(admin) question.should be_editable_by(admin, :title) question.should be_editable_by(admin, :documentation) - question.should be_editable_by(admin, :category) question.should be_editable_by(admin, :approved) question.should_not be_editable_by(admin, :user) |