aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-08-20 08:00:03 +0100
committerRobin Houston <robin.houston@gmail.com>2012-08-20 08:00:03 +0100
commit99457f15722b3326ba11ecb3003c3dd50b70a9c4 (patch)
treeb53c02957035180d6cfae29b2d161a6949311b94
parent6f66fe8a30083a2fa49618b4dad828c0cef3b310 (diff)
Fix tests
Also make the InfoRequest#is_old_unclassified? method a little more conservative, by returning false only is the is_external? method returns true. This makes it subtly inconsistent with InfoRequest.find_old_unclassified, but it is better I think to be subtly inconsistent than to risk breaking things that used to work.
-rw-r--r--app/models/info_request.rb2
-rw-r--r--spec/models/info_request_spec.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 6426f6ea8..e88c3a95f 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -960,7 +960,7 @@ public
end
def is_old_unclassified?
- return false if user_id.nil?
+ return false if is_external?
return false if !awaiting_description
return false if url_title == 'holding_pen'
last_response_event = get_last_response_event
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 98ee34381..41d01c89a 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -353,7 +353,7 @@ describe InfoRequest do
InfoRequest.should_receive(:find).with(:all,
{:select=> anything,
:order=> anything,
- :conditions=>["awaiting_description = ? and (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) < ? and url_title != 'holding_pen' and prominence != 'backpage'",
+ :conditions=>["awaiting_description = ? and (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) < ? and url_title != 'holding_pen' and user_id is not null and prominence != 'backpage'",
true, Time.now - 21.days]})
InfoRequest.find_old_unclassified({:conditions => ["prominence != 'backpage'"]})
end
@@ -362,7 +362,7 @@ describe InfoRequest do
InfoRequest.should_receive(:find).with(:all,
{:select=>"*, (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) as last_response_time",
:order=>"last_response_time",
- :conditions=>["awaiting_description = ? and (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) < ? and url_title != 'holding_pen'",
+ :conditions=>["awaiting_description = ? and (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) < ? and url_title != 'holding_pen' and user_id is not null",
true, Time.now - 21.days]})
InfoRequest.find_old_unclassified
end
@@ -396,7 +396,7 @@ describe InfoRequest do
end
it 'should return true if it is awaiting description, isn\'t the holding pen and hasn\'t had an event in 21 days' do
- @info_request.is_old_unclassified?.should be_true
+ (@info_request.is_external? || @info_request.is_old_unclassified?).should be_true
end
end