Ensure that test utility methods are marked as private
This allows us to enable the check for test method names.
This commit is contained in:
parent
86a5e198f7
commit
da2277505f
10 changed files with 40 additions and 47 deletions
|
@ -84,21 +84,6 @@ Metrics/PerceivedComplexity:
|
||||||
Minitest/MultipleAssertions:
|
Minitest/MultipleAssertions:
|
||||||
Max: 81
|
Max: 81
|
||||||
|
|
||||||
# Offense count: 26
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Minitest/TestMethodName:
|
|
||||||
Exclude:
|
|
||||||
- 'test/abilities/api_capability_test.rb'
|
|
||||||
- 'test/controllers/api/nodes_controller_test.rb'
|
|
||||||
- 'test/controllers/api/old_nodes_controller_test.rb'
|
|
||||||
- 'test/controllers/api/relations_controller_test.rb'
|
|
||||||
- 'test/controllers/api/ways_controller_test.rb'
|
|
||||||
- 'test/helpers/browse_helper_test.rb'
|
|
||||||
- 'test/integration/client_applications_test.rb'
|
|
||||||
- 'test/integration/short_links_test.rb'
|
|
||||||
- 'test/integration/user_blocks_test.rb'
|
|
||||||
- 'test/integration/user_creation_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
Naming/AccessorMethodName:
|
Naming/AccessorMethodName:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
class ApiCapabilityTest < ActiveSupport::TestCase
|
class ApiCapabilityTest < ActiveSupport::TestCase
|
||||||
|
private
|
||||||
|
|
||||||
def tokens(*toks)
|
def tokens(*toks)
|
||||||
AccessToken.new do |token|
|
AccessToken.new do |token|
|
||||||
toks.each do |t|
|
toks.each do |t|
|
||||||
|
|
|
@ -559,6 +559,8 @@ module Api
|
||||||
assert_includes apinode.tags, "\#{@user.inspect}"
|
assert_includes apinode.tags, "\#{@user.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
##
|
##
|
||||||
# update the changeset_id of a node element
|
# update the changeset_id of a node element
|
||||||
def update_changeset(xml, changeset_id)
|
def update_changeset(xml, changeset_id)
|
||||||
|
|
|
@ -161,13 +161,6 @@ module Api
|
||||||
check_not_found_id_version(24356, create(:node).version)
|
check_not_found_id_version(24356, create(:node).version)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_not_found_id_version(id, version)
|
|
||||||
get node_version_path(:id => id, :version => version)
|
|
||||||
assert_response :not_found
|
|
||||||
rescue ActionController::UrlGenerationError => e
|
|
||||||
assert_match(/No route matches/, e.to_s)
|
|
||||||
end
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Test that getting the current version is identical to picking
|
# Test that getting the current version is identical to picking
|
||||||
# that version with the version URI call.
|
# that version with the version URI call.
|
||||||
|
@ -412,6 +405,13 @@ module Api
|
||||||
assert_nodes_are_equal current_node, old_node
|
assert_nodes_are_equal current_node, old_node
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_not_found_id_version(id, version)
|
||||||
|
get node_version_path(:id => id, :version => version)
|
||||||
|
assert_response :not_found
|
||||||
|
rescue ActionController::UrlGenerationError => e
|
||||||
|
assert_match(/No route matches/, e.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# returns a 16 character long string with some nasty characters in it.
|
# returns a 16 character long string with some nasty characters in it.
|
||||||
# this ought to stress-test the tag handling as well as the versioning.
|
# this ought to stress-test the tag handling as well as the versioning.
|
||||||
|
|
|
@ -151,25 +151,6 @@ module Api
|
||||||
[relation_with_relation, second_relation])
|
[relation_with_relation, second_relation])
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_relations_for_element(path, type, id, expected_relations)
|
|
||||||
# check the "relations for relation" mode
|
|
||||||
get path
|
|
||||||
assert_response :success
|
|
||||||
|
|
||||||
# count one osm element
|
|
||||||
assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
|
|
||||||
|
|
||||||
# we should have only the expected number of relations
|
|
||||||
assert_select "osm>relation", expected_relations.size
|
|
||||||
|
|
||||||
# and each of them should contain the element we originally searched for
|
|
||||||
expected_relations.each do |relation|
|
|
||||||
# The relation should appear once, but the element could appear multiple times
|
|
||||||
assert_select "osm>relation[id='#{relation.id}']", 1
|
|
||||||
assert_select "osm>relation[id='#{relation.id}']>member[type='#{type}'][ref='#{id}']"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_full
|
def test_full
|
||||||
# check the "full" mode
|
# check the "full" mode
|
||||||
get relation_full_path(:id => 999999)
|
get relation_full_path(:id => 999999)
|
||||||
|
@ -926,9 +907,26 @@ module Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# ============================================================
|
private
|
||||||
# utility functions
|
|
||||||
# ============================================================
|
def check_relations_for_element(path, type, id, expected_relations)
|
||||||
|
# check the "relations for relation" mode
|
||||||
|
get path
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
# count one osm element
|
||||||
|
assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
|
||||||
|
|
||||||
|
# we should have only the expected number of relations
|
||||||
|
assert_select "osm>relation", expected_relations.size
|
||||||
|
|
||||||
|
# and each of them should contain the element we originally searched for
|
||||||
|
expected_relations.each do |relation|
|
||||||
|
# The relation should appear once, but the element could appear multiple times
|
||||||
|
assert_select "osm>relation[id='#{relation.id}']", 1
|
||||||
|
assert_select "osm>relation[id='#{relation.id}']>member[type='#{type}'][ref='#{id}']"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# checks that the XML document and the string arguments have
|
# checks that the XML document and the string arguments have
|
||||||
|
|
|
@ -754,6 +754,8 @@ module Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
##
|
##
|
||||||
# update the changeset_id of a way element
|
# update the changeset_id of a way element
|
||||||
def update_changeset(xml, changeset_id)
|
def update_changeset(xml, changeset_id)
|
||||||
|
|
|
@ -132,6 +132,8 @@ class BrowseHelperTest < ActionView::TestCase
|
||||||
assert_includes tags, %w[shop gift]
|
assert_includes tags, %w[shop gift]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def add_old_tags_selection(old_node)
|
def add_old_tags_selection(old_node)
|
||||||
{ "building" => "yes",
|
{ "building" => "yes",
|
||||||
"shop" => "gift",
|
"shop" => "gift",
|
||||||
|
@ -152,8 +154,6 @@ class BrowseHelperTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def preferred_languages
|
def preferred_languages
|
||||||
Locale.list(I18n.locale)
|
Locale.list(I18n.locale)
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,6 +76,8 @@ class ClientApplicationsTest < ActionDispatch::IntegrationTest
|
||||||
# tests, as its too tied into the HTTP headers and stuff that it signs.
|
# tests, as its too tied into the HTTP headers and stuff that it signs.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
##
|
##
|
||||||
# utility method to make the HTML screening easier to read.
|
# utility method to make the HTML screening easier to read.
|
||||||
def assert_in_heading(&block)
|
def assert_in_heading(&block)
|
||||||
|
|
|
@ -9,6 +9,8 @@ class ShortLinksTest < ActionDispatch::IntegrationTest
|
||||||
assert_short_link_redirect(ShortLink.encode(-0.107846, 51.50771, 18))
|
assert_short_link_redirect(ShortLink.encode(-0.107846, 51.50771, 18))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
##
|
##
|
||||||
# utility method to test short links
|
# utility method to test short links
|
||||||
def assert_short_link_redirect(short_link)
|
def assert_short_link_redirect(short_link)
|
||||||
|
|
|
@ -157,7 +157,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check that the user can successfully recover their password
|
# Check that the user can successfully recover their password
|
||||||
def lost_password_recovery_success
|
def test_lost_password_recovery_success
|
||||||
# Open the lost password form
|
# Open the lost password form
|
||||||
# Submit the lost password form
|
# Submit the lost password form
|
||||||
# Check the e-mail
|
# Check the e-mail
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue