aboutsummaryrefslogtreecommitdiffstats
path: root/spec/helpers/link_to_helper_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-09-07 12:51:42 +0100
committerRobin Houston <robin.houston@gmail.com>2012-09-07 12:51:42 +0100
commitc690679f5e55d908a0f91b0d9b3276ae3f748b2d (patch)
treecbe46b2e859aa6f59d39a110d997274091004a24 /spec/helpers/link_to_helper_spec.rb
parent67a3a43cc26f8ad7218f33a13af04c3c74347866 (diff)
parentdd39dbc580b1447758a6d3b9231ce09c9b3dcdf3 (diff)
Merge branch 'wdtk' of git.mysociety.org:/data/git/public/alaveteli into wdtk
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