aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/info_request_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 3451e018f..5b9460ae7 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -423,6 +423,43 @@ describe InfoRequest do
end
+ describe 'when asked for random old unclassified requests with normal prominence' do
+
+ it "should not return requests that don't have normal prominence" do
+ dog_request = info_requests(:fancy_dog_request)
+ old_unclassified = InfoRequest.get_random_old_unclassified(1, :conditions => ["prominence = 'normal'"])
+ old_unclassified.length.should == 1
+ old_unclassified.first.should == dog_request
+ dog_request.prominence = 'requester_only'
+ dog_request.save!
+ old_unclassified = InfoRequest.get_random_old_unclassified(1, :conditions => ["prominence = 'normal'"])
+ old_unclassified.length.should == 0
+ dog_request.prominence = 'hidden'
+ dog_request.save!
+ old_unclassified = InfoRequest.get_random_old_unclassified(1, :conditions => ["prominence = 'normal'"])
+ old_unclassified.length.should == 0
+ end
+
+ end
+
+ describe 'when asked to count old unclassified requests with normal prominence' do
+
+ it "should not return requests that don't have normal prominence" do
+ dog_request = info_requests(:fancy_dog_request)
+ old_unclassified = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"])
+ old_unclassified.should == 1
+ dog_request.prominence = 'requester_only'
+ dog_request.save!
+ old_unclassified = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"])
+ old_unclassified.should == 0
+ dog_request.prominence = 'hidden'
+ dog_request.save!
+ old_unclassified = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"])
+ old_unclassified.should == 0
+ end
+
+ end
+
describe 'when an instance is asked if it is old and unclassified' do
before do