aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin_request_controller_spec.rb5
-rw-r--r--spec/fixtures/info_request_events.yml35
-rw-r--r--spec/fixtures/info_requests.yml10
-rw-r--r--spec/fixtures/outgoing_messages.yml11
-rw-r--r--spec/helpers/link_to_helper_spec.rb32
5 files changed, 70 insertions, 23 deletions
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index 252818452..8a3934685 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -21,6 +21,11 @@ describe AdminRequestController, "when administering requests" do
get :show, :id => info_requests(:fancy_dog_request)
end
+ it 'shows an external public body with no username' do
+ get :show, :id => info_requests(:anonymous_external_request)
+ response.should be_success
+ end
+
it "edits a public body" do
get :edit, :id => info_requests(:fancy_dog_request)
end
diff --git a/spec/fixtures/info_request_events.yml b/spec/fixtures/info_request_events.yml
index e3e8a4460..c1a00ad47 100644
--- a/spec/fixtures/info_request_events.yml
+++ b/spec/fixtures/info_request_events.yml
@@ -16,7 +16,7 @@ silly_outgoing_message_event:
created_at: 2007-10-14 10:41:12.686264
described_state:
outgoing_message_id: 2
-useless_incoming_message_event:
+useless_incoming_message_event:
id: 902
params_yaml: "--- \n\
:incoming_message_id: 1\n"
@@ -25,18 +25,18 @@ useless_incoming_message_event:
created_at: 2007-11-13 18:09:20.042061
described_state:
incoming_message_id: 1
-silly_comment_event:
+silly_comment_event:
id: 903
params_yaml: "--- \n\
:comment_id: 1\n"
- incoming_message_id:
- last_described_at:
- described_state:
+ incoming_message_id:
+ last_described_at:
+ described_state:
info_request_id: 101
comment_id: 1
- calculated_state:
+ calculated_state:
event_type: comment
- outgoing_message_id:
+ outgoing_message_id:
created_at: 2008-08-12 23:05:12.500942
badger_outgoing_message_event:
id: 904
@@ -98,11 +98,11 @@ another_comment_event:
comment_id: 2
params_yaml: "--- \n\
:comment_id: 2\n"
- incoming_message_id:
- outgoing_message_id:
- last_described_at:
- described_state:
- calculated_state:
+ incoming_message_id:
+ outgoing_message_id:
+ last_described_at:
+ described_state:
+ calculated_state:
event_type: comment
created_at: 2008-08-12 12:05:12.879634
@@ -160,3 +160,14 @@ external_outgoing_message_event:
created_at: 2009-01-02 02:23:45.6789100
described_state: waiting_response
calculated_state: waiting_response
+
+anonymous_external_outgoing_message_event:
+ id: 915
+ params_yaml: "--- \n\
+ :outgoing_message_id: 9\n"
+ outgoing_message_id: 9
+ info_request_id: 110
+ event_type: sent
+ created_at: 2009-01-03 02:23:45.6789100
+ described_state: waiting_response
+ calculated_state: waiting_response
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index e4f2287c0..079a44cd0 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -88,3 +88,13 @@ external_request:
described_state: waiting_response
awaiting_description: false
idhash: a1234567
+anonymous_external_request:
+ id: 110
+ title: Anonymous request
+ url_title: anonymous_request
+ external_user_name:
+ external_url: http://www.example.org/request/anonymous_requesr
+ public_body_id: 2
+ described_state: waiting_response
+ awaiting_description: false
+ idhash: 7654321a \ No newline at end of file
diff --git a/spec/fixtures/outgoing_messages.yml b/spec/fixtures/outgoing_messages.yml
index 32b322bd7..55df8473e 100644
--- a/spec/fixtures/outgoing_messages.yml
+++ b/spec/fixtures/outgoing_messages.yml
@@ -97,3 +97,14 @@ external_outgoing_message:
updated_at: 2009-01-12 01:56:58.586598
what_doing: normal_sort
+anonymous_external_outgoing_message:
+ id: 9
+ info_request_id: 110
+ message_type: initial_request
+ status: sent
+ body: "I do not wish to reveal my name, but would like all your information."
+ last_sent_at: 2009-01-12 01:57:58.586598
+ created_at: 2009-01-12 01:56:58.586598
+ updated_at: 2009-01-12 01:56:58.586598
+ what_doing: normal_sort
+
diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb
index f11f2b5bb..9ec0afce1 100644
--- a/spec/helpers/link_to_helper_spec.rb
+++ b/spec/helpers/link_to_helper_spec.rb
@@ -1,11 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-describe LinkToHelper do
-
+describe LinkToHelper do
+
include LinkToHelper
-
- describe 'when creating a url for a request' do
-
+
+ describe 'when creating a url for a request' do
+
before do
@mock_request = mock_model(InfoRequest, :url_title => 'test_title')
@old_filters = ActionController::Routing::Routes.filters
@@ -15,15 +15,15 @@ describe LinkToHelper do
ActionController::Routing::Routes.filters = @old_filters
end
-
- it 'should return a path like /request/test_title' do
+
+ it 'should return a path like /request/test_title' do
request_url(@mock_request).should == '/request/test_title'
end
-
- it 'should return a path including any extra parameters passed' do
+
+ it 'should return a path including any extra parameters passed' do
request_url(@mock_request, {:update_status => 1}).should == '/request/test_title?update_status=1'
end
-
+
end
describe "when appending something to a URL" do
@@ -37,5 +37,15 @@ describe LinkToHelper do
main_url('/a?z=9%', '.json').should == 'http://test.host/a?z=9%'
end
end
-
+
+ describe 'when displaying a user admin link for a request' do
+
+ it 'should return the text "An anonymous user (external)" in the case where there is no external username' do
+ info_request = mock_model(InfoRequest, :external_user_name => nil,
+ :is_external? => true)
+ user_admin_link_for_request(info_request).should == 'Anonymous user (external)'
+ end
+
+ end
+
end