diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb index d5c134ae..c750d9c4 100644 --- a/app/controllers/relationships_controller.rb +++ b/app/controllers/relationships_controller.rb @@ -11,7 +11,7 @@ class RelationshipsController < ApplicationController UseCase::Relationship::Create.call( source_user: current_user, target_user: ::User.find_by!(screen_name: params[:screen_name]), - type: params[:type] + type: params[:type], ) respond_to do |format| @@ -30,7 +30,7 @@ class RelationshipsController < ApplicationController UseCase::Relationship::Destroy.call( source_user: current_user, target_user: ::User.find_by!(screen_name: params[:screen_name]), - type: params[:type] + type: params[:type], ) respond_to do |format| diff --git a/app/views/relationships/_destroy.html.haml b/app/views/relationships/_destroy.html.haml index 00b81b93..f26ec521 100644 --- a/app/views/relationships/_destroy.html.haml +++ b/app/views/relationships/_destroy.html.haml @@ -1,5 +1,6 @@ - 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") - if type == "block" diff --git a/spec/controllers/relationships_controller_spec.rb b/spec/controllers/relationships_controller_spec.rb index 6b3bed06..68c6a4e3 100644 --- a/spec/controllers/relationships_controller_spec.rb +++ b/spec/controllers/relationships_controller_spec.rb @@ -41,9 +41,9 @@ describe RelationshipsController, type: :controller do let(:type) { "Sauerkraut" } 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" @@ -116,9 +116,9 @@ describe RelationshipsController, type: :controller do let(:type) { "Sauerkraut" } 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" diff --git a/spec/shared_examples/error_raising.rb b/spec/shared_examples/error_raising.rb index 34417e22..8ddf0b63 100644 --- a/spec/shared_examples/error_raising.rb +++ b/spec/shared_examples/error_raising.rb @@ -14,7 +14,7 @@ RSpec.shared_examples_for "ajax does not succeed" do |part_of_error_message| 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 subject # FIXME: for some reason, partials are not rendered, making the actual error message not accessible