diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-08-30 17:49:28 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-08-30 17:49:28 +0100 |
commit | 74531a783a8ea62a80596b435bd151cec2bf82c8 (patch) | |
tree | f0d27526768e6a50d1fccf17e5a723324441bb13 /spec/helpers/link_to_helper_spec.rb | |
parent | ee723d9e6645bc7987cb2b7cc9cd320950536201 (diff) | |
parent | 62a20d6696275a6f83ca4cf835c487873ca89c99 (diff) |
Merge branch 'release/0.6.5'0.6.5
Diffstat (limited to 'spec/helpers/link_to_helper_spec.rb')
-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 |