def update
if @valid_params
- if @user_block.creator != current_user
- flash[:error] = t(".only_creator_can_edit")
+ if current_user != @user_block.creator &&
+ current_user != @user_block.revoker
+ flash[:error] = t(@user_block.revoker ? ".only_creator_or_revoker_can_edit" : ".only_creator_can_edit")
redirect_to :action => "edit"
elsif @user_block.update(
:ends_at => Time.now.utc + @block_period.hours,
<% end %>
</td>
<td><%= link_to t(".show"), block %></td>
- <td><% if current_user and current_user.id == block.creator_id %><%= link_to t(".edit"), edit_user_block_path(block) %><% end %></td>
+ <td><% if current_user && (current_user.id == block.creator_id ||
+ current_user.id == block.revoker_id) %><%= link_to t(".edit"), edit_user_block_path(block) %><% end %></td>
<% if show_revoke_link %>
<td><% if block.active? %><%= link_to t(".revoke"), revoke_user_block_path(block) %><% end %></td>
<% end %>
<dd class="col-sm-9"><div class="richtext text-break"><%= @user_block.reason.to_html %></div></dd>
</dl>
-<% if current_user&.id == @user_block.creator_id || can?(:revoke, UserBlock) && @user_block.active? %>
+<% if current_user && (current_user.id == @user_block.creator_id ||
+ current_user.id == @user_block.revoker_id) ||
+ can?(:revoke, UserBlock) && @user_block.active? %>
<div>
- <% if current_user&.id == @user_block.creator_id %>
+ <% if current_user && (current_user.id == @user_block.creator_id ||
+ current_user.id == @user_block.revoker_id) %>
<%= link_to t(".edit"), edit_user_block_path(@user_block), :class => "btn btn-outline-primary" %>
<% end %>
<% if can?(:revoke, UserBlock) && @user_block.active? %>
flash: "Created a block on user %{name}."
update:
only_creator_can_edit: "Only the moderator who created this block can edit it."
+ only_creator_or_revoker_can_edit: "Only the moderators who created or revoked this block can edit it."
success: "Block updated."
index:
title: "User blocks"
delete "gpx/:id" => "traces#destroy", :id => /\d+/
get "gpx/:id/details" => "traces#show", :id => /\d+/
get "gpx/:id/data" => "traces#data", :as => :api_trace_data
+ end
+ namespace :api, :path => "api/0.6" do
# Map notes API
- resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "notes", :as => :api_notes do
+ resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do
collection do
get "search"
get "feed", :defaults => { :format => "rss" }
end
end
- resources :user_blocks, :only => [:show], :constraints => { :id => /\d+/ }, :controller => "user_blocks", :as => :api_user_blocks
+ resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks"
end
# Data browsing
assert_difference "ChangesetComment.count", 1 do
assert_no_difference "ActionMailer::Base.deliveries.size" do
perform_enqueued_jobs do
- post changeset_comment_path(:id => private_user_closed_changeset, :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(private_user_closed_changeset, :text => "This is a comment"), :headers => auth_header
end
end
end
assert_difference "ChangesetComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 1 do
perform_enqueued_jobs do
- post changeset_comment_path(:id => changeset, :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "This is a comment"), :headers => auth_header
end
end
end
assert_difference "ChangesetComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 2 do
perform_enqueued_jobs do
- post changeset_comment_path(:id => changeset, :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "This is a comment"), :headers => auth_header
end
end
end
# create comment fail
def test_create_comment_fail
# unauthorized
- post changeset_comment_path(:id => create(:changeset, :closed), :text => "This is a comment")
+ post changeset_comment_path(create(:changeset, :closed), :text => "This is a comment")
assert_response :unauthorized
auth_header = basic_authorization_header create(:user).email, "test"
# bad changeset id
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => 999111, :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(999111, :text => "This is a comment"), :headers => auth_header
end
assert_response :not_found
# not closed changeset
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => create(:changeset), :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(create(:changeset), :text => "This is a comment"), :headers => auth_header
end
assert_response :conflict
# no text
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => create(:changeset, :closed)), :headers => auth_header
+ post changeset_comment_path(create(:changeset, :closed)), :headers => auth_header
end
assert_response :bad_request
# empty text
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => create(:changeset, :closed), :text => ""), :headers => auth_header
+ post changeset_comment_path(create(:changeset, :closed), :text => ""), :headers => auth_header
end
assert_response :bad_request
end
assert_difference "ChangesetComment.count", Settings.initial_changeset_comments_per_hour do
1.upto(Settings.initial_changeset_comments_per_hour) do |count|
- post changeset_comment_path(:id => changeset, :text => "Comment #{count}"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "Comment #{count}"), :headers => auth_header
assert_response :success
end
end
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => changeset, :text => "One comment too many"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "One comment too many"), :headers => auth_header
assert_response :too_many_requests
end
end
assert_difference "ChangesetComment.count", Settings.max_changeset_comments_per_hour do
1.upto(Settings.max_changeset_comments_per_hour) do |count|
- post changeset_comment_path(:id => changeset, :text => "Comment #{count}"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "Comment #{count}"), :headers => auth_header
assert_response :success
end
end
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => changeset, :text => "One comment too many"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "One comment too many"), :headers => auth_header
assert_response :too_many_requests
end
end
assert_difference "ChangesetComment.count", Settings.initial_changeset_comments_per_hour / 2 do
1.upto(Settings.initial_changeset_comments_per_hour / 2) do |count|
- post changeset_comment_path(:id => changeset, :text => "Comment #{count}"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "Comment #{count}"), :headers => auth_header
assert_response :success
end
end
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => changeset, :text => "One comment too many"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "One comment too many"), :headers => auth_header
assert_response :too_many_requests
end
end
assert_difference "ChangesetComment.count", Settings.moderator_changeset_comments_per_hour do
1.upto(Settings.moderator_changeset_comments_per_hour) do |count|
- post changeset_comment_path(:id => changeset, :text => "Comment #{count}"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "Comment #{count}"), :headers => auth_header
assert_response :success
end
end
assert_no_difference "ChangesetComment.count" do
- post changeset_comment_path(:id => changeset, :text => "One comment too many"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "One comment too many"), :headers => auth_header
assert_response :too_many_requests
end
end
changeset = create(:changeset, :closed)
assert_difference "ChangesetComment.count", 0 do
- post changeset_comment_path(:id => changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token)
+ post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token)
end
assert_response :forbidden
user.save!
assert_difference "ChangesetComment.count", 1 do
- post changeset_comment_path(:id => changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token)
+ post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token)
end
assert_response :success
end
auth_header = basic_authorization_header user.email, "test"
assert_difference "ChangesetComment.count", 0 do
- post changeset_comment_path(:id => changeset, :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "This is a comment"), :headers => auth_header
end
assert_response :forbidden
user.save!
assert_difference "ChangesetComment.count", 1 do
- post changeset_comment_path(:id => changeset, :text => "This is a comment"), :headers => auth_header
+ post changeset_comment_path(changeset, :text => "This is a comment"), :headers => auth_header
end
assert_response :success
end
# check that a changeset that doesn't exist returns an appropriate message
def test_show_not_found
[0, -32, 233455644, "afg", "213"].each do |id|
- get changeset_show_path(:id => id)
+ get changeset_show_path(id)
assert_response :not_found, "should get a not found"
rescue ActionController::UrlGenerationError => e
assert_match(/No route matches/, e.to_s)
auth_header = basic_authorization_header user.email, "test"
cs_id = changeset.id
- put changeset_close_path(:id => cs_id), :headers => auth_header
+ put changeset_close_path(cs_id), :headers => auth_header
assert_response :success
# test that it really is closed now
# First try to do it with no auth
cs_ids.each do |id|
- put changeset_close_path(:id => id)
+ put changeset_close_path(id)
assert_response :unauthorized, "Shouldn't be able close the non-existant changeset #{id}, when not authorized"
rescue ActionController::UrlGenerationError => e
assert_match(/No route matches/, e.to_s)
# Now try with auth
auth_header = basic_authorization_header create(:user).email, "test"
cs_ids.each do |id|
- put changeset_close_path(:id => id), :headers => auth_header
+ put changeset_close_path(id), :headers => auth_header
assert_response :not_found, "The changeset #{id} doesn't exist, so can't be closed"
rescue ActionController::UrlGenerationError => e
assert_match(/No route matches/, e.to_s)
# upload it, which used to cause an error like "PGError: ERROR:
# integer out of range" (bug #2152). but shouldn't any more.
- post changeset_upload_path(:id => changeset_id), :params => diff, :headers => auth_header
+ post changeset_upload_path(changeset_id), :params => diff, :headers => auth_header
assert_response :success,
"can't upload a spatially-large diff to changeset: #{@response.body}"
diff.root << modify
# upload it
- post changeset_upload_path(:id => changeset_id), :params => diff.to_s, :headers => auth_header
+ post changeset_upload_path(changeset_id), :params => diff.to_s, :headers => auth_header
assert_response :success,
"diff should have uploaded OK"
diff.root << modify
# upload it
- post changeset_upload_path(:id => changeset_id), :params => diff.to_s, :headers => auth_header
+ post changeset_upload_path(changeset_id), :params => diff.to_s, :headers => auth_header
assert_response :success,
"diff should have uploaded OK"
CHANGESET
# upload it
- post changeset_upload_path(:id => changeset_id), :params => diff, :headers => auth_header
+ post changeset_upload_path(changeset_id), :params => diff, :headers => auth_header
assert_response :success,
"can't upload multiple versions of an element in a diff: #{@response.body}"
- get changeset_download_path(:id => changeset_id)
+ get changeset_download_path(changeset_id)
assert_response :success
assert_select "osmChange", 1
OSMFILE
# upload it
- post changeset_upload_path(:id => changeset_id), :params => diff, :headers => auth_header
+ post changeset_upload_path(changeset_id), :params => diff, :headers => auth_header
assert_response :success,
"can't upload a diff from JOSM: #{@response.body}"
- get changeset_download_path(:id => changeset_id)
+ get changeset_download_path(changeset_id)
assert_response :success
assert_select "osmChange", 1
CHANGESET
# upload it
- post changeset_upload_path(:id => changeset_id), :params => diff, :headers => auth_header
+ post changeset_upload_path(changeset_id), :params => diff, :headers => auth_header
assert_response :success,
"can't upload multiple versions of an element in a diff: #{@response.body}"
- get changeset_download_path(:id => changeset_id)
+ get changeset_download_path(changeset_id)
assert_response :success
assert_select "osmChange", 1
end
# get the bounding box back from the changeset
- get changeset_show_path(:id => changeset_id)
+ get changeset_show_path(changeset_id)
assert_response :success, "Couldn't read back changeset."
assert_select "osm>changeset[min_lon='0.1000000']", 1
assert_select "osm>changeset[max_lon='0.1000000']", 1
end
# get the bounding box back from the changeset
- get changeset_show_path(:id => changeset_id)
+ get changeset_show_path(changeset_id)
assert_response :success, "Couldn't read back changeset for the second time."
assert_select "osm>changeset[min_lon='0.1000000']", 1
assert_select "osm>changeset[max_lon='0.2000000']", 1
end
# get the bounding box back from the changeset
- get changeset_show_path(:id => changeset_id)
+ get changeset_show_path(changeset_id)
assert_response :success, "Couldn't read back changeset for the third time."
assert_select "osm>changeset[min_lon='0.1000000']", 1
assert_select "osm>changeset[max_lon='0.3000000']", 1
# bad changeset id
assert_no_difference "changeset.subscribers.count" do
- post api_changeset_unsubscribe_path(:id => 999111), :headers => auth_header
+ post api_changeset_unsubscribe_path(999111), :headers => auth_header
end
assert_response :not_found
# now download the changeset to check its bounding box
with_controller(Api::ChangesetsController.new) do
- get changeset_show_path(:id => changeset_id)
+ get changeset_show_path(changeset_id)
assert_response :success, "can't re-read changeset for modify test"
assert_select "osm>changeset", 1, "Changeset element doesn't exist in #{@response.body}"
assert_select "osm>changeset[id='#{changeset_id}']", 1, "Changeset id=#{changeset_id} doesn't exist in #{@response.body}"
change << modify
modify << doc.import(rel.find("//osm/relation").first)
- post changeset_upload_path(:id => cs_id), :params => doc.to_s, :headers => headers
+ post changeset_upload_path(cs_id), :params => doc.to_s, :headers => headers
assert_response :success, "can't upload diff relation: #{@response.body}"
version = xml_parse(@response.body).find("//diffResult/relation").first["new_version"].to_i
end
issue = create(:issue, :reportable => target_user, :reported_user => target_user, :assigned_role => "moderator")
# Access issue without login
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_redirected_to login_path(:referer => issue_path(issue))
# Access issue as normal user
session_for(create(:user))
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Access issue as administrator
session_for(create(:administrator_user))
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
# Access issue as moderator
session_for(create(:moderator_user))
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_response :success
end
issue = create(:issue, :reportable => target_user, :reported_user => target_user, :assigned_role => "administrator")
# Access issue without login
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_redirected_to login_path(:referer => issue_path(issue))
# Access issue as normal user
session_for(create(:user))
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Access issue as moderator
session_for(create(:moderator_user))
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
# Access issue as administrator
session_for(create(:administrator_user))
- get issue_path(:id => issue)
+ get issue_path(issue)
assert_response :success
end
issue = create(:issue, :reportable => target_user, :reported_user => target_user, :assigned_role => "moderator")
# Resolve issue without login
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_response :forbidden
# Resolve issue as normal user
session_for(create(:user))
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Resolve issue as administrator
session_for(create(:administrator_user))
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
- assert_not issue.reload.resolved?
+ assert_not_predicate issue.reload, :resolved?
# Resolve issue as moderator
session_for(create(:moderator_user))
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_response :redirect
assert_predicate issue.reload, :resolved?
end
issue = create(:issue, :reportable => target_user, :reported_user => target_user, :assigned_role => "administrator")
# Resolve issue without login
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_response :forbidden
# Resolve issue as normal user
session_for(create(:user))
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Resolve issue as moderator
session_for(create(:moderator_user))
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
- assert_not issue.reload.resolved?
+ assert_not_predicate issue.reload, :resolved?
# Resolve issue as administrator
session_for(create(:administrator_user))
- post resolve_issue_path(:id => issue)
+ post resolve_issue_path(issue)
assert_response :redirect
assert_predicate issue.reload, :resolved?
end
issue = create(:issue, :reportable => target_user, :reported_user => target_user, :assigned_role => "moderator")
# Ignore issue without login
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_response :forbidden
# Ignore issue as normal user
session_for(create(:user))
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Ignore issue as administrator
session_for(create(:administrator_user))
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
- assert_not issue.reload.ignored?
+ assert_not_predicate issue.reload, :ignored?
# Ignore issue as moderator
session_for(create(:moderator_user))
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_response :redirect
assert_predicate issue.reload, :ignored?
end
issue = create(:issue, :reportable => target_user, :reported_user => target_user, :assigned_role => "administrator")
# Ignore issue without login
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_response :forbidden
# Ignore issue as normal user
session_for(create(:user))
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Ignore issue as moderator
session_for(create(:moderator_user))
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
- assert_not issue.reload.ignored?
+ assert_not_predicate issue.reload, :ignored?
# Ignore issue as administrator
session_for(create(:administrator_user))
- post ignore_issue_path(:id => issue)
+ post ignore_issue_path(issue)
assert_response :redirect
assert_predicate issue.reload, :ignored?
end
issue.resolve!
# Reopen issue without login
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_response :forbidden
# Reopen issue as normal user
session_for(create(:user))
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Reopen issue as administrator
session_for(create(:administrator_user))
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
- assert_not issue.reload.open?
+ assert_not_predicate issue.reload, :open?
# Reopen issue as moderator
session_for(create(:moderator_user))
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_response :redirect
assert_predicate issue.reload, :open?
end
issue.resolve!
# Reopen issue without login
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_response :forbidden
# Reopen issue as normal user
session_for(create(:user))
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :forbidden
# Reopen issue as moderator
session_for(create(:moderator_user))
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_redirected_to :controller => :errors, :action => :not_found
- assert_not issue.reload.open?
+ assert_not_predicate issue.reload, :open?
# Reopen issue as administrator
session_for(create(:administrator_user))
- post reopen_issue_path(:id => issue)
+ post reopen_issue_path(issue)
assert_response :redirect
assert_predicate issue.reload, :open?
end
check_block_buttons block, :edit => 1
session_for(revoker_user)
- check_block_buttons block
- end
-
- private
-
- def check_block_buttons(block, edit: 0, revoke: 0)
- [user_blocks_path, user_block_path(block)].each do |path|
- get path
- assert_response :success
- assert_select "a[href='#{edit_user_block_path block}']", :count => edit
- assert_select "a[href='#{revoke_user_block_path block}']", :count => revoke
- end
+ check_block_buttons block, :edit => 1
end
- public
-
##
# test the new action
def test_new
assert_equal "Original Reason", block.reason
session_for(creator_user)
+ check_block_updates(block)
+ end
+
+ ##
+ # test the update action on revoked blocks
+ def test_update_revoked
+ creator_user = create(:moderator_user)
+ revoker_user = create(:moderator_user)
+ other_moderator_user = create(:moderator_user)
+ block = create(:user_block, :revoked, :creator => creator_user, :revoker => revoker_user, :reason => "Original Reason")
+
+ session_for(other_moderator_user)
put user_block_path(block,
:user_block_period => "0",
:user_block => { :needs_view => false, :reason => "Updated Reason" })
- assert_redirected_to user_block_path(block)
- assert_equal "Block updated.", flash[:notice]
+ assert_redirected_to edit_user_block_path(block)
+ assert_equal "Only the moderators who created or revoked this block can edit it.", flash[:error]
block.reload
- assert_not block.active?
- assert_equal "Updated Reason", block.reason
+ assert_not_predicate block, :active?
+ assert_equal "Original Reason", block.reason
- put user_block_path(block,
- :user_block_period => "0",
- :user_block => { :needs_view => true, :reason => "Updated Reason 2" })
- assert_redirected_to user_block_path(block)
- assert_equal "Block updated.", flash[:notice]
- block.reload
- assert_predicate block, :active?
- assert_equal "Updated Reason 2", block.reason
+ session_for(creator_user)
+ check_block_updates(block)
+
+ session_for(revoker_user)
+ check_block_updates(block)
end
##
private
+ def check_block_buttons(block, edit: 0, revoke: 0)
+ [user_blocks_path, user_block_path(block)].each do |path|
+ get path
+ assert_response :success
+ assert_select "a[href='#{edit_user_block_path block}']", :count => edit
+ assert_select "a[href='#{revoke_user_block_path block}']", :count => revoke
+ end
+ end
+
+ def check_block_updates(block)
+ put user_block_path(block,
+ :user_block_period => "0",
+ :user_block => { :needs_view => false, :reason => "Updated Reason" })
+ assert_redirected_to user_block_path(block)
+ assert_equal "Block updated.", flash[:notice]
+ block.reload
+ assert_not_predicate block, :active?
+ assert_equal "Updated Reason", block.reason
+
+ put user_block_path(block,
+ :user_block_period => "0",
+ :user_block => { :needs_view => true, :reason => "Updated Reason 2" })
+ assert_redirected_to user_block_path(block)
+ assert_equal "Block updated.", flash[:notice]
+ block.reload
+ assert_predicate block, :active?
+ assert_equal "Updated Reason 2", block.reason
+ end
+
def check_user_blocks_table(user_blocks)
assert_dom "table#block_list tbody tr" do |rows|
assert_equal user_blocks.count, rows.count, "unexpected number of rows in user blocks table"
user = build(:user)
user.display_name = "user_#{existing_user.id}"
- assert_not user.valid?, "user_<id> name is valid for existing user id when it shouldn't be"
+ assert_not_predicate user, :valid?, "user_<id> name is valid for existing user id when it shouldn't be"
user.display_name = "user_#{existing_user.id + 1}"
- assert_not user.valid?, "user_<id> name is valid for new user id when it shouldn't be"
+ assert_not_predicate user, :valid?, "user_<id> name is valid for new user id when it shouldn't be"
end
def test_display_name_user_id_rename
user = create(:user)
user.display_name = "user_#{existing_user.id}"
- assert_not user.valid?, "user_<id> name is valid for existing user id when it shouldn't be"
+ assert_not_predicate user, :valid?, "user_<id> name is valid for existing user id when it shouldn't be"
user.display_name = "user_#{user.id}"
assert_predicate user, :valid?, "user_<id> name is invalid for own id, when it should be"
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae"
integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==
-"@eslint/config-array@^0.17.0":
- version "0.17.0"
- resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.0.tgz#ff305e1ee618a00e6e5d0485454c8d92d94a860d"
- integrity sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==
+"@eslint/config-array@^0.17.1":
+ version "0.17.1"
+ resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.1.tgz#d9b8b8b6b946f47388f32bedfd3adf29ca8f8910"
+ integrity sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==
dependencies:
"@eslint/object-schema" "^2.1.4"
debug "^4.3.1"
minimatch "^3.1.2"
strip-json-comments "^3.1.1"
-"@eslint/js@9.7.0":
- version "9.7.0"
- resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.7.0.tgz#b712d802582f02b11cfdf83a85040a296afec3f0"
- integrity sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==
+"@eslint/js@9.8.0":
+ version "9.8.0"
+ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.8.0.tgz#ae9bc14bb839713c5056f5018bcefa955556d3a4"
+ integrity sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==
"@eslint/object-schema@^2.1.4":
version "2.1.4"
integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==
eslint@^9.0.0:
- version "9.7.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.7.0.tgz#bedb48e1cdc2362a0caaa106a4c6ed943e8b09e4"
- integrity sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw==
+ version "9.8.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.8.0.tgz#a4f4a090c8ea2d10864d89a6603e02ce9f649f0f"
+ integrity sha512-K8qnZ/QJzT2dLKdZJVX6W4XOwBzutMYmt0lqUS+JdXgd+HTYFlonFgkJ8s44d/zMPPCnOOk0kMWCApCPhiOy9A==
dependencies:
"@eslint-community/eslint-utils" "^4.2.0"
"@eslint-community/regexpp" "^4.11.0"
- "@eslint/config-array" "^0.17.0"
+ "@eslint/config-array" "^0.17.1"
"@eslint/eslintrc" "^3.1.0"
- "@eslint/js" "9.7.0"
+ "@eslint/js" "9.8.0"
"@humanwhocodes/module-importer" "^1.0.1"
"@humanwhocodes/retry" "^0.3.0"
"@nodelib/fs.walk" "^1.2.8"