Fix lint nits

This commit is contained in:
Andreas Nedbal 2023-10-26 22:15:51 +02:00 committed by Karina Kwiatek
parent e222ab7c30
commit 54fb4d09fd
4 changed files with 9 additions and 8 deletions

View File

@ -11,7 +11,7 @@ class RelationshipsController < ApplicationController
UseCase::Relationship::Create.call( UseCase::Relationship::Create.call(
source_user: current_user, source_user: current_user,
target_user: ::User.find_by!(screen_name: params[:screen_name]), target_user: ::User.find_by!(screen_name: params[:screen_name]),
type: params[:type] type: params[:type],
) )
respond_to do |format| respond_to do |format|
@ -30,7 +30,7 @@ class RelationshipsController < ApplicationController
UseCase::Relationship::Destroy.call( UseCase::Relationship::Destroy.call(
source_user: current_user, source_user: current_user,
target_user: ::User.find_by!(screen_name: params[:screen_name]), target_user: ::User.find_by!(screen_name: params[:screen_name]),
type: params[:type] type: params[:type],
) )
respond_to do |format| respond_to do |format|

View File

@ -1,5 +1,6 @@
- if type == "follow" - if type == "follow"
= button_to relationships_path(screen_name:, type:), method: :delete, form: { id: "#{type}-#{screen_name}" }, class: "btn btn-primary", form_class: "d-grid" do = button_to relationships_path(screen_name:, type:), method: :delete, form: { id: "#{type}-#{screen_name}" }, class: "btn btn-primary",
form_class: "d-grid" do
= t("voc.unfollow") = t("voc.unfollow")
- if type == "block" - if type == "block"

View File

@ -41,9 +41,9 @@ describe RelationshipsController, type: :controller do
let(:type) { "Sauerkraut" } let(:type) { "Sauerkraut" }
let(:screen_name) { user2.screen_name } let(:screen_name) { user2.screen_name }
let(:params) { { type: type, screen_name: screen_name } } let(:params) { { type:, screen_name: } }
subject { post(:create, params: params, format: :turbo_stream) } subject { post(:create, params:, format: :turbo_stream) }
it_behaves_like "requires login" it_behaves_like "requires login"
@ -116,9 +116,9 @@ describe RelationshipsController, type: :controller do
let(:type) { "Sauerkraut" } let(:type) { "Sauerkraut" }
let(:screen_name) { user2.screen_name } let(:screen_name) { user2.screen_name }
let(:params) { { type: type, screen_name: screen_name } } let(:params) { { type:, screen_name: } }
subject { delete(:destroy, params: params, format: :turbo_stream) } subject { delete(:destroy, params:, format: :turbo_stream) }
it_behaves_like "requires login" it_behaves_like "requires login"

View File

@ -14,7 +14,7 @@ RSpec.shared_examples_for "ajax does not succeed" do |part_of_error_message|
end end
end end
RSpec.shared_examples_for "turbo does not succeed" do |part_of_error_message| RSpec.shared_examples_for "turbo does not succeed" do
it "turbo does not succeed" do it "turbo does not succeed" do
subject subject
# FIXME: for some reason, partials are not rendered, making the actual error message not accessible # FIXME: for some reason, partials are not rendered, making the actual error message not accessible