diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb index c750d9c4..e9965f79 100644 --- a/app/controllers/relationships_controller.rb +++ b/app/controllers/relationships_controller.rb @@ -8,6 +8,8 @@ class RelationshipsController < ApplicationController turbo_stream_actions :create, :destroy def create + params.require :screen_name + UseCase::Relationship::Create.call( source_user: current_user, target_user: ::User.find_by!(screen_name: params[:screen_name]), diff --git a/spec/controllers/relationships_controller_spec.rb b/spec/controllers/relationships_controller_spec.rb index 68c6a4e3..9642b34b 100644 --- a/spec/controllers/relationships_controller_spec.rb +++ b/spec/controllers/relationships_controller_spec.rb @@ -4,6 +4,8 @@ require "rails_helper" describe RelationshipsController, type: :controller do + render_views + shared_examples_for "params is empty" do let(:params) { {} } diff --git a/spec/shared_examples/error_raising.rb b/spec/shared_examples/error_raising.rb index 8ddf0b63..527318b1 100644 --- a/spec/shared_examples/error_raising.rb +++ b/spec/shared_examples/error_raising.rb @@ -14,10 +14,9 @@ RSpec.shared_examples_for "ajax does not succeed" do |part_of_error_message| end end -RSpec.shared_examples_for "turbo does not succeed" do +RSpec.shared_examples_for "turbo does not succeed" do |part_of_error_message| it "turbo does not succeed" do subject - # FIXME: for some reason, partials are not rendered, making the actual error message not accessible - expect(response.body).to include "turbo-stream action=\"append\" target=\"toasts\"" + expect(response.body).to include(part_of_error_message) end end