assert_routing(
{ :path => "/user/username", :method => :get },
- { :controller => "user", :action => "view", :display_name => "username" }
+ { :controller => "user", :action => "show", :display_name => "username" }
)
assert_routing(
# Check that the user account page will display and contains some relevant
# information for the user
- def test_view
+ def test_show
# Test a non-existent user
- get :view, :params => { :display_name => "unknown" }
+ get :show, :params => { :display_name => "unknown" }
assert_response :not_found
# Test a normal user
user = create(:user)
- get :view, :params => { :display_name => user.display_name }
+ get :show, :params => { :display_name => user.display_name }
assert_response :success
assert_select "div#userinformation" do
assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
# Test a user who has been blocked
blocked_user = create(:user)
create(:user_block, :user => blocked_user)
- get :view, :params => { :display_name => blocked_user.display_name }
+ get :show, :params => { :display_name => blocked_user.display_name }
assert_response :success
assert_select "div#userinformation" do
assert_select "a[href^='/user/#{ERB::Util.u(blocked_user.display_name)}/history']", 1
# Test a moderator who has applied blocks
moderator_user = create(:moderator_user)
create(:user_block, :creator => moderator_user)
- get :view, :params => { :display_name => moderator_user.display_name }
+ get :show, :params => { :display_name => moderator_user.display_name }
assert_response :success
assert_select "div#userinformation" do
assert_select "a[href^='/user/#{ERB::Util.u(moderator_user.display_name)}/history']", 1
session[:user] = user.id
# Test the normal user
- get :view, :params => { :display_name => user.display_name }
+ get :show, :params => { :display_name => user.display_name }
assert_response :success
assert_select "div#userinformation" do
assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
session[:user] = create(:moderator_user).id
# Test the normal user
- get :view, :params => { :display_name => user.display_name }
+ get :show, :params => { :display_name => user.display_name }
assert_response :success
assert_select "div#userinformation" do
assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
seen_user = create(:user, :terms_seen => true)
not_seen_user = create(:user, :terms_seen => false)
- get :view, :params => { :display_name => agreed_user.display_name }
+ get :show, :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 }
+ get :show, :params => { :display_name => seen_user.display_name }
assert_response :success
# put @response.body
assert_select "div#userinformation" do
assert_select "p", /Declined/
end
- get :view, :params => { :display_name => not_seen_user.display_name }
+ get :show, :params => { :display_name => not_seen_user.display_name }
assert_response :success
assert_select "div#userinformation" do
assert_select "p", :count => 1, :text => /Contributor terms/
# Now try as a normal user
get :set_status, :params => { :display_name => user.display_name, :status => "suspended" }, :session => { :user => user }
assert_response :redirect
- assert_redirected_to :action => :view, :display_name => user.display_name
+ assert_redirected_to :action => :show, :display_name => user.display_name
# Finally try as an administrator
get :set_status, :params => { :display_name => user.display_name, :status => "suspended" }, :session => { :user => create(:administrator_user) }
assert_response :redirect
- assert_redirected_to :action => :view, :display_name => user.display_name
+ assert_redirected_to :action => :show, :display_name => user.display_name
assert_equal "suspended", User.find(user.id).status
end
# Now try as a normal user
get :delete, :params => { :display_name => user.display_name, :status => "suspended" }, :session => { :user => user }
assert_response :redirect
- assert_redirected_to :action => :view, :display_name => user.display_name
+ assert_redirected_to :action => :show, :display_name => user.display_name
# Finally try as an administrator
get :delete, :params => { :display_name => user.display_name, :status => "suspended" }, :session => { :user => create(:administrator_user) }
assert_response :redirect
- assert_redirected_to :action => :view, :display_name => user.display_name
+ assert_redirected_to :action => :show, :display_name => user.display_name
# Check that the user was deleted properly
user.reload