diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-03-04 09:53:26 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-03-04 09:53:26 +0000 |
commit | 3912c73583464e3ff203e3e101325ccabcba0506 (patch) | |
tree | 3b57620358c4c4cfe1c52702f2979876f6452aa0 /spec/helpers | |
parent | 2a49615ee3ea08f7952283efc0306a1ac0c23334 (diff) | |
parent | af83354da1030c2d2fad3c63f3ccb516c4923d38 (diff) |
Merge branch 'release/0.17' into wdtk
Conflicts:
config/general.yml-example
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/link_to_helper_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index b29419ef3..2259db6c2 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -20,6 +20,45 @@ describe LinkToHelper do end + describe 'when displaying a user link for a request' do + + context "for external requests" do + before do + @info_request = mock_model(InfoRequest, :external_user_name => nil, + :is_external? => true) + end + + it 'should return the text "Anonymous user" with a link to the privacy help pages when there is no external username' do + request_user_link(@info_request).should == '<a href="/help/privacy#anonymous">Anonymous user</a>' + end + + it 'should return a link with an alternative text if requested' do + request_user_link(@info_request, 'other text').should == '<a href="/help/privacy#anonymous">other text</a>' + end + + it 'should display an absolute link if requested' do + request_user_link_absolute(@info_request).should == '<a href="http://test.host/help/privacy#anonymous">Anonymous user</a>' + end + end + + context "for normal requests" do + + before do + @info_request = FactoryGirl.build(:info_request) + end + + it 'should display a relative link by default' do + request_user_link(@info_request).should == '<a href="/user/example_user">Example User</a>' + end + + it 'should display an absolute link if requested' do + request_user_link_absolute(@info_request).should == '<a href="http://test.host/user/example_user">Example User</a>' + end + + 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 |