aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/controllers/general_controller_spec.rb12
-rw-r--r--spec/fixtures/incoming_messages.yml16
-rw-r--r--spec/fixtures/info_request_events.yml27
-rw-r--r--spec/fixtures/info_requests.yml15
-rw-r--r--spec/fixtures/outgoing_messages.yml10
-rw-r--r--spec/fixtures/raw_emails.yml3
6 files changed, 73 insertions, 10 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 2750a33f3..c4fd46c14 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -108,6 +108,18 @@ describe GeneralController, "when searching" do
I18n.available_locales = old_i18n_available_locales
end
end
+
+ describe 'when constructing the list of recent requests' do
+ before(:each) do
+ load_raw_emails_data(raw_emails)
+ rebuild_xapian_index
+ end
+
+ it 'should list the successful request first' do
+ get :frontpage
+ assigns[:request_events].first.info_request.should == info_requests(:boring_request)
+ end
+ end
describe 'when using xapian search' do
diff --git a/spec/fixtures/incoming_messages.yml b/spec/fixtures/incoming_messages.yml
index e15a466ca..2a5dd872b 100644
--- a/spec/fixtures/incoming_messages.yml
+++ b/spec/fixtures/incoming_messages.yml
@@ -1,7 +1,13 @@
useless_incoming_message:
- id: 1
- info_request_id: 101
- updated_at: 2007-11-13 18:09:20.042061
- raw_email_id: 1
- created_at: 2007-11-13 18:09:20.042061
+ id: 1
+ info_request_id: 101
+ updated_at: 2007-11-13 18:09:20.042061
+ raw_email_id: 1
+ created_at: 2007-11-13 18:09:20.042061
+useful_incoming_message:
+ id: 2
+ info_request_id: 105
+ raw_email_id: 2
+ created_at: 2012-01-26 10:19:23
+ updated_at: 2012-01-26 10:19:23
diff --git a/spec/fixtures/info_request_events.yml b/spec/fixtures/info_request_events.yml
index 9c6aa393d..b19845345 100644
--- a/spec/fixtures/info_request_events.yml
+++ b/spec/fixtures/info_request_events.yml
@@ -32,8 +32,8 @@ silly_comment_event:
last_described_at:
described_state:
id: "903"
- info_request_id: "101"
- comment_id: "1"
+ info_request_id: 101
+ comment_id: 1
calculated_state:
event_type: comment
outgoing_message_id:
@@ -45,6 +45,27 @@ badger_outgoing_message_event:
info_request_id: 104
event_type: sent
created_at: 2011-10-12 01:56:58.586598
- described_state:
+ described_state: waiting_response
+ calculated_state: waiting_response
outgoing_message_id: 3
+boring_outgoing_message_event:
+ id: 905
+ params_yaml: "--- \n\
+ :outgoing_message_id: 4\n"
+ outgoing_message_id: 4
+ info_request_id: 105
+ event_type: sent
+ created_at: 2006-01-12 01:56:58.586598
+ described_state: waiting_response
+ calculated_state: waiting_response
+useful_incoming_message_event:
+ id: 906
+ params_yaml: "--- \n\
+ :incoming_message_id: 2\n"
+ incoming_message_id: 2
+ info_request_id: 105
+ event_type: response
+ created_at: 2007-11-13 18:09:20.042061
+ described_state: successful
+ calculated_state: successful
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index 7b7e55ba6..9f767e7f3 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -18,7 +18,7 @@ naughty_chicken_request:
public_body_id: 2
user_id: 1
described_state: waiting_response
- awaiting_description: false
+ awaiting_description: false
idhash: e8d18c84
badger_request:
id: 104
@@ -29,5 +29,16 @@ badger_request:
public_body_id: 3
user_id: 1
described_state: waiting_response
- awaiting_description: false
+ awaiting_description: false
idhash: e8d18c84
+boring_request:
+ id: 105
+ title: The cost of boring
+ url_title: the_cost_of_boring
+ created_at: 2012-01-26 10:19:23
+ updated_at: 2012-01-26 10:19:23
+ public_body_id: 3
+ user_id: 1
+ described_state: successful
+ awaiting_description: false
+ idhash: 173fd003
diff --git a/spec/fixtures/outgoing_messages.yml b/spec/fixtures/outgoing_messages.yml
index 0cebdd5c5..3afce92f5 100644
--- a/spec/fixtures/outgoing_messages.yml
+++ b/spec/fixtures/outgoing_messages.yml
@@ -43,6 +43,16 @@ badger_outgoing_message:
last_sent_at: 2011-10-14 10:41:12.686264
created_at: 2011-10-14 01:56:58.586598
what_doing: normal_sort
+boring_outgoing_message:
+ id: 4
+ info_request_id: 105
+ message_type: initial_request
+ status: sent
+ updated_at: 2012-01-14 01:56:58.586598
+ body: "How much was spent on boring equipment in the 2010-2011 financial year?"
+ last_sent_at: 2012-01-14 10:41:12.686264
+ created_at: 2012-01-14 01:56:58.586598
+ what_doing: normal_sort
diff --git a/spec/fixtures/raw_emails.yml b/spec/fixtures/raw_emails.yml
index 8ef9248a3..32e039cab 100644
--- a/spec/fixtures/raw_emails.yml
+++ b/spec/fixtures/raw_emails.yml
@@ -1,2 +1,5 @@
useless_raw_email:
id: 1
+
+useful_raw_email:
+ id: 2