- assert_select "a[href^='/user/test/history']", 1
- assert_select "a[href='/user/test/traces']", 1
- assert_select "a[href='/user/test/diary']", 1
- assert_select "a[href='/user/test/diary/comments']", 1
- assert_select "a[href='/user/test/account']", 0
- assert_select "a[href='/user/test/blocks']", 0
- assert_select "a[href='/user/test/blocks_by']", 0
- assert_select "a[href='/blocks/new/test']", 1
+ assert_select "a[href^='/user/#{URI.encode(user.display_name)}/history']", 1
+ assert_select "a[href='/user/#{URI.encode(user.display_name)}/traces']", 1
+ assert_select "a[href='/user/#{URI.encode(user.display_name)}/diary']", 1
+ assert_select "a[href='/user/#{URI.encode(user.display_name)}/diary/comments']", 1
+ assert_select "a[href='/user/#{URI.encode(user.display_name)}/account']", 0
+ assert_select "a[href='/user/#{URI.encode(user.display_name)}/blocks']", 0
+ assert_select "a[href='/user/#{URI.encode(user.display_name)}/blocks_by']", 0
+ assert_select "a[href='/blocks/new/#{URI.encode(user.display_name)}']", 1
+ end
+ end
+
+ # Test whether information about contributor terms is shown for users who haven't agreed
+ def test_terms_not_agreed
+ agreed_user = create(:user, :terms_agreed => 3.days.ago)
+ seen_user = create(:user, :terms_seen => true)
+ not_seen_user = create(:user, :terms_seen => false)
+
+ get :view, :params => { :display_name => agreed_user.display_name }
+ assert_response :success
+ assert_select "div#userinformation" do
+ assert_select "p", :count => 0, :text => /Contributor terms/
+ end
+
+ get :view, :params => { :display_name => seen_user.display_name }
+ assert_response :success
+ # put @response.body
+ assert_select "div#userinformation" do
+ assert_select "p", :count => 1, :text => /Contributor terms/
+ assert_select "p", /Declined/
+ end
+
+ get :view, :params => { :display_name => not_seen_user.display_name }
+ assert_response :success
+ assert_select "div#userinformation" do
+ assert_select "p", :count => 1, :text => /Contributor terms/
+ assert_select "p", /Undecided/