authorize_resource
- before_action :lookup_user, :only => [:new, :create, :blocks_on, :blocks_by]
+ before_action :lookup_user, :only => [:new, :create, :revoke_all, :blocks_on, :blocks_by]
before_action :lookup_user_block, :only => [:show, :edit, :update, :revoke]
before_action :require_valid_params, :only => [:create, :update]
before_action :check_database_readable
+<% @title = t ".title",
+ :block_on => @user.display_name %>
+
+<% content_for :heading do %>
+ <h1><%= t ".heading_html",
+ :block_on => link_to(@user.display_name,
+ user_path(@user)) %></h1>
+<% end %>
confirm: "Are you sure you wish to revoke this block?"
revoke: "Revoke!"
flash: "This block has been revoked."
+ revoke_all:
+ title: "Revoking all blocks on %{block_on}"
+ heading_html: "Revoking all blocks on %{block_on}"
helper:
time_future_html: "Ends in %{time}."
until_login: "Active until the user logs in."
assert_no_link "Revoke all blocks"
end
- test "revoke all link is present for moderators when viewed user has active blocks" do
+ test "revoke all link is present and working for moderators when viewed user has active blocks" do
blocked_user = create(:user)
create(:user_block, :user => blocked_user)
sign_in_as(create(:moderator_user))
visit user_path(blocked_user)
assert_link "Revoke all blocks"
+
+ click_link "Revoke all blocks"
+ assert_title "Revoking all blocks on #{blocked_user.display_name}"
+ assert_text "Revoking all blocks on #{blocked_user.display_name}"
end
end