aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/answer_spec.rb')
-rw-r--r--spec/models/answer_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/answer_spec.rb b/spec/models/answer_spec.rb
index 9a60bb8..b9cdb05 100644
--- a/spec/models/answer_spec.rb
+++ b/spec/models/answer_spec.rb
@@ -332,4 +332,20 @@ describe Answer do
Answer.new(:owner => user).should be_editable_by(user, :reference)
end
end
+
+ it "should properly return answers with feedback" do
+
+ with_feedback = (Answer.new.feedback.class.values - ['']).collect do |fb|
+ Factory(:answer, :feedback => fb)
+ end
+
+ without_feedback = ['', nil].collect do |fb|
+ Factory(:answer, :feedback => fb)
+ end
+
+ with_feedback.each{ |ans| Answer.with_some_feedback.include?(ans).should be_true }
+ without_feedback.each{ |ans| Answer.with_some_feedback.include?(ans).should be_false }
+
+ Answer.with_some_feedback.count.should == Answer.with_some_feedback.uniq.count
+ end
end