# Updating the description should work
user.description = "new description"
+ user.preferred_editor = "default"
post :account, :params => { :display_name => user.display_name, :user => user.attributes }, :session => { :user => user }
assert_response :success
assert_template :account
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/
+ end
+ end
+
def test_api_read
user = create(:user, :description => "test", :terms_agreed => Date.yesterday)
# check that a visible user is returned properly
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "pending", inactive_user.reload.status
assert_equal "suspended", suspended_user.reload.status
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "pending", inactive_user.reload.status
assert_equal "suspended", suspended_user.reload.status
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "pending", inactive_user.reload.status
assert_equal "suspended", suspended_user.reload.status
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "active", normal_user.reload.status
assert_equal "confirmed", confirmed_user.reload.status
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "active", normal_user.reload.status
assert_equal "confirmed", confirmed_user.reload.status
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "active", normal_user.reload.status
assert_equal "confirmed", confirmed_user.reload.status