aboutsummaryrefslogtreecommitdiffstats
path: root/spec/helpers/link_to_helper_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-03-04 10:46:46 +0000
committerLouise Crow <louise.crow@gmail.com>2014-03-04 10:46:46 +0000
commitede46dc8dc6c97cdad8c3fcb3bd42ede5c25f395 (patch)
tree44e03358c9fa7ca6826e631d1d3d6c1030b1b0d5 /spec/helpers/link_to_helper_spec.rb
parent8e911d5bd0e60a0e0e4859868662cc176419d2e3 (diff)
parenta38b2989aebf8d554b7287e18528bed8c9e67d3b (diff)
Merge branch 'release/0.17'0.17
Diffstat (limited to 'spec/helpers/link_to_helper_spec.rb')
-rw-r--r--spec/helpers/link_to_helper_spec.rb39
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