aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-13 10:32:45 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-14 13:15:31 +0200
commit9f4e827991ac35586a46f44fc996d524d8608229 (patch)
tree247bc5490a4f063718da57f2b2ff0c841b4b6c58
parentImprove coverage of ProjectAcceptance model and fix found bug (diff)
downloadrecruiting-webapp-9f4e827991ac35586a46f44fc996d524d8608229.tar.gz
recruiting-webapp-9f4e827991ac35586a46f44fc996d524d8608229.tar.bz2
recruiting-webapp-9f4e827991ac35586a46f44fc996d524d8608229.zip
Improve coverage of QuestionCategory model
-rw-r--r--spec/models/question_category_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/question_category_spec.rb b/spec/models/question_category_spec.rb
index 96d5c99..32511a8 100644
--- a/spec/models/question_category_spec.rb
+++ b/spec/models/question_category_spec.rb
@@ -18,4 +18,14 @@ describe QuestionCategory do
end
it { should validate_presence_of :name }
+
+ it "should return proper as_select_opts" do
+ c1 = Factory(:question_category)
+ c2 = Factory(:question_category)
+ options = [['All Categories', nil], [c1.name, c1.id], [c2.name, c2.id]]
+
+ (options - QuestionCategory.as_select_opts).should be_empty
+ (QuestionCategory.as_select_opts - options).should be_empty
+ QuestionCategory.as_select_opts.count.should == QuestionCategory.as_select_opts.uniq.count
+ end
end