aboutsummaryrefslogtreecommitdiffstats
path: root/spec/helpers/link_to_helper_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-09-06 15:00:05 +0100
committerRobin Houston <robin.houston@gmail.com>2012-09-06 15:00:05 +0100
commit006717f1ac39557e50052bb5755d430a1fa100ee (patch)
treed07209a4ad2003111c03948d537127d40dda9799 /spec/helpers/link_to_helper_spec.rb
parent537b97ff069cac999da3ca80ede77fedc79e39ff (diff)
parent74531a783a8ea62a80596b435bd151cec2bf82c8 (diff)
Merge branch 'master' of git.mysociety.org:/data/git/public/alaveteli
Conflicts: spec/controllers/api_controller_spec.rb
Diffstat (limited to 'spec/helpers/link_to_helper_spec.rb')
-rw-r--r--spec/helpers/link_to_helper_spec.rb32
1 files changed, 21 insertions, 11 deletions
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