diff options
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/link_to_helper_spec.rb | 32 |
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 |