rubocop: fix various style issues.

This commit is contained in:
evazion
2019-12-22 16:21:58 -06:00
parent 09f6a84660
commit 309821bf73
288 changed files with 912 additions and 962 deletions

View File

@@ -5,7 +5,7 @@ class Admin::DashboardsControllerTest < ActionDispatch::IntegrationTest
setup do
@admin = create(:admin_user)
end
context "show action" do
should "render" do
get_auth admin_dashboard_path, @admin

View File

@@ -21,10 +21,10 @@ class ArtistCommentariesControllerTest < ActionDispatch::IntegrationTest
params = {
search: {
text_matches: @commentary1.original_title,
post_id: @commentary1.post_id,
post_id: @commentary1.post_id,
original_present: "yes",
translated_present: "yes",
post_tags_match: @commentary1.post.tag_array.first,
post_tags_match: @commentary1.post.tag_array.first
}
}
@@ -48,7 +48,7 @@ class ArtistCommentariesControllerTest < ActionDispatch::IntegrationTest
params = {
artist_commentary: {
original_title: "foo",
post_id: FactoryBot.create(:post).id,
post_id: FactoryBot.create(:post).id
},
format: "js"
}
@@ -63,7 +63,7 @@ class ArtistCommentariesControllerTest < ActionDispatch::IntegrationTest
params = {
artist_commentary: {
post_id: @commentary1.post_id,
original_title: "foo",
original_title: "foo"
},
format: "js"
}

View File

@@ -12,7 +12,7 @@ class ArtistUrlsControllerTest < ActionDispatch::IntegrationTest
@artist = FactoryBot.create(:artist, name: "bkub", url_string: "-http://bkub.com")
get artist_urls_path(search: {
artist: { name: "bkub", },
artist: { name: "bkub" },
url_matches: "*bkub*",
is_active: "false",
order: "created_at"

View File

@@ -185,7 +185,7 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
end
end
context "create action"do
context "create action" do
should "create a comment" do
assert_difference("Comment.count", 1) do
post_auth comments_path, @user, params: {comment: FactoryBot.attributes_for(:comment, post_id: @post.id)}

View File

@@ -117,16 +117,16 @@ class ForumTopicsControllerTest < ActionDispatch::IntegrationTest
get forum_topics_path, params: {:search => {:title_matches => "forum"}}
assert_response :success
assert_select "a.forum-post-link", @forum_topic.title
assert_select "a.forum-post-link", {count: 0, text: @topic1.title}
assert_select "a.forum-post-link", {count: 0, text: @topic2.title}
assert_select "a.forum-post-link", count: 0, text: @topic1.title
assert_select "a.forum-post-link", count: 0, text: @topic2.title
end
should "list nothing for when the search matches nothing" do
get forum_topics_path, params: {:search => {:title_matches => "bababa"}}
assert_response :success
assert_select "a.forum-post-link", {count: 0, text: @forum_topic.title}
assert_select "a.forum-post-link", {count: 0, text: @topic1.title}
assert_select "a.forum-post-link", {count: 0, text: @topic2.title}
assert_select "a.forum-post-link", count: 0, text: @forum_topic.title
assert_select "a.forum-post-link", count: 0, text: @topic1.title
assert_select "a.forum-post-link", count: 0, text: @topic2.title
end
end
end

View File

@@ -24,4 +24,4 @@ module Maintenance
end
end
end
end
end

View File

@@ -36,4 +36,4 @@ module Maintenance
end
end
end
end
end

View File

@@ -64,7 +64,7 @@ module Moderator
end
end
context "for notes"do
context "for notes" do
setup do
as(@user) do
@post = create(:post)

View File

@@ -6,7 +6,7 @@ module Moderator
setup do
PoolArchive.delete_all
PostArchive.delete_all
travel_to(1.month.ago) do
@user = create(:moderator_user)
end

View File

@@ -26,7 +26,7 @@ module Moderator
assert_difference("PostDisapproval.count", 1) do
post_auth moderator_post_disapprovals_path, @admin, params: { post_disapproval: { post_id: @post.id, reason: "breaks_rules" }, format: "json" }
end
assert_response :success
assert_response :success
end
end
end

View File

@@ -9,7 +9,7 @@ module Moderator
travel_to(1.month.ago) do
@user = create(:gold_user)
end
as_user do
@post = create(:post)
end
@@ -69,7 +69,7 @@ module Moderator
@child = create(:post, parent: @parent)
end
users = FactoryBot.create_list(:user, 2)
users.each do |u|
users.each do |u|
@child.add_favorite!(u)
@child.reload
end

View File

@@ -24,7 +24,7 @@ class NotesControllerTest < ActionDispatch::IntegrationTest
post_id: @note.post_id,
post_tags_match: @note.post.tag_array.first,
creator_name: @note.creator.name,
creator_id: @note.creator_id,
creator_id: @note.creator_id
}
}

View File

@@ -16,7 +16,7 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
format: :json,
post_id: @post.id,
post_replacement: {
replacement_url: "https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg",
replacement_url: "https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg"
}
}
@@ -42,7 +42,7 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
id: @post_replacement.id,
post_replacement: {
file_size_was: 23,
file_size: 42,
file_size: 42
}
}

View File

@@ -32,7 +32,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
end
end
context "preprocess action" do
context "preprocess action" do
should "prefer the file over the source when preprocessing" do
file = Rack::Test::UploadedFile.new("#{Rails.root}/test/files/test.jpg", "image/jpeg")
post_auth preprocess_uploads_path, @user, params: {:upload => {:source => "https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg", :file => file}}
@@ -154,7 +154,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
source_matches: @upload.source,
rating: @upload.rating,
status: @upload.status,
server: @upload.server,
server: @upload.server
}
get uploads_path, params: { search: search_params }
@@ -192,13 +192,13 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
end
should "update the predecessor" do
assert_difference(->{ Post.count }, 1) do
assert_difference(->{ Upload.count }, 0) do
assert_difference(-> { Post.count }, 1) do
assert_difference(-> { Upload.count }, 0) do
post_auth uploads_path, @user, params: {:upload => {:tag_string => "aaa", :rating => "q", :source => @source, :referer_url => @ref}}
end
end
post = Post.last
assert_match(/aaa/, post.tag_string)
assert_match(/aaa/, post.tag_string)
end
end
@@ -212,13 +212,13 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
end
should "update the predecessor" do
assert_difference(->{ Post.count }, 1) do
assert_difference(->{ Upload.count }, 0) do
assert_difference(-> { Post.count }, 1) do
assert_difference(-> { Upload.count }, 0) do
post_auth uploads_path, @user, params: {:upload => {:tag_string => "aaa", :rating => "q", :source => @source, :referer_url => @ref}}
end
end
post = Post.last
assert_match(/aaa/, post.tag_string)
assert_match(/aaa/, post.tag_string)
end
end
end

View File

@@ -105,7 +105,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
setup do
Danbooru.config.stubs(:enable_recaptcha?).returns(false)
end
should "render" do
get new_user_path
assert_response :success
@@ -121,7 +121,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
context "with sockpuppet validation enabled" do
setup do
Danbooru.config.unstub(:enable_sock_puppet_validation?)
Danbooru.config.unstub(:enable_sock_puppet_validation?)
@user.update(last_ip_addr: "127.0.0.1")
end