Fix rubocop warnings

This commit is contained in:
Tom Hughes 2016-01-19 00:19:09 +00:00
parent 2ef6a960d1
commit 8fe1899596
58 changed files with 500 additions and 488 deletions

View file

@ -5,7 +5,7 @@ class MessageTest < ActiveSupport::TestCase
api_fixtures
fixtures :messages
EURO = "\xe2\x82\xac" # euro symbol
EURO = "\xe2\x82\xac".freeze # euro symbol
# This needs to be updated when new fixtures are added
# or removed.

View file

@ -22,8 +22,8 @@ class NoteCommentTest < ActiveSupport::TestCase
end
def test_body_valid
ok = ["Name", "vergrößern", "foo\x0abar",
"ルシステムにも対応します", "輕觸搖晃的遊戲"]
ok = %W(Name vergrößern foo\nbar
)
bad = ["foo\x00bar", "foo\x08bar", "foo\x1fbar", "foo\x7fbar",
"foo\ufffebar", "foo\uffffbar"]

View file

@ -0,0 +1,12 @@
require "test_helper"
class RequestTokenTest < ActiveSupport::TestCase
api_fixtures
def test_oob
assert_equal true, RequestToken.new.oob?
assert_equal true, RequestToken.new(:callback_url => "oob").oob?
assert_equal true, RequestToken.new(:callback_url => "OOB").oob?
assert_equal false, RequestToken.new(:callback_url => "http://test.host/").oob?
end
end

View file

@ -26,30 +26,30 @@ class TraceTest < ActiveSupport::TestCase
def test_visible
check_query(Trace.visible, [
:public_trace_file, :anon_trace_file, :trackable_trace_file,
:identifiable_trace_file, :zipped_trace_file, :tar_trace_file,
:tar_gzip_trace_file, :tar_bzip_trace_file, :pending_trace_file
])
:public_trace_file, :anon_trace_file, :trackable_trace_file,
:identifiable_trace_file, :zipped_trace_file, :tar_trace_file,
:tar_gzip_trace_file, :tar_bzip_trace_file, :pending_trace_file
])
end
def test_visible_to
check_query(Trace.visible_to(1), [
:public_trace_file, :identifiable_trace_file, :pending_trace_file
])
:public_trace_file, :identifiable_trace_file, :pending_trace_file
])
check_query(Trace.visible_to(2), [
:public_trace_file, :anon_trace_file, :trackable_trace_file,
:identifiable_trace_file, :pending_trace_file
])
:public_trace_file, :anon_trace_file, :trackable_trace_file,
:identifiable_trace_file, :pending_trace_file
])
check_query(Trace.visible_to(3), [
:public_trace_file, :identifiable_trace_file, :pending_trace_file
])
:public_trace_file, :identifiable_trace_file, :pending_trace_file
])
end
def test_visible_to_all
check_query(Trace.visible_to_all, [
:public_trace_file, :identifiable_trace_file,
:deleted_trace_file, :pending_trace_file
])
:public_trace_file, :identifiable_trace_file,
:deleted_trace_file, :pending_trace_file
])
end
def test_tagged

View file

@ -20,7 +20,7 @@ class UserPreferenceTest < ActiveSupport::TestCase
new_up.k = up.k
new_up.v = "some other value"
assert_not_equal new_up.v, up.v
assert_raise (ActiveRecord::RecordNotUnique) { new_up.save }
assert_raise(ActiveRecord::RecordNotUnique) { new_up.save }
end
def test_check_valid_length

View file

@ -29,7 +29,7 @@ class WayTest < ActiveSupport::TestCase
way = Way.find(current_ways(:visible_way).id)
assert way.valid?
# it already has 1 node
1.upto((MAX_NUMBER_OF_WAY_NODES) / 2) do
1.upto(MAX_NUMBER_OF_WAY_NODES / 2) do
way.add_nd_num(current_nodes(:used_node_1).id)
way.add_nd_num(current_nodes(:used_node_2).id)
end