mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:19:52 +01:00
Make turbo does not succeed
example for in RelationshipsController
This commit is contained in:
parent
54fb4d09fd
commit
e802e0197d
3 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,8 @@ class RelationshipsController < ApplicationController
|
||||||
turbo_stream_actions :create, :destroy
|
turbo_stream_actions :create, :destroy
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
params.require :screen_name
|
||||||
|
|
||||||
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]),
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe RelationshipsController, type: :controller do
|
describe RelationshipsController, type: :controller do
|
||||||
|
render_views
|
||||||
|
|
||||||
shared_examples_for "params is empty" do
|
shared_examples_for "params is empty" do
|
||||||
let(:params) { {} }
|
let(:params) { {} }
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,9 @@ 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
|
RSpec.shared_examples_for "turbo does not succeed" do |part_of_error_message|
|
||||||
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
|
expect(response.body).to include(part_of_error_message)
|
||||||
expect(response.body).to include "turbo-stream action=\"append\" target=\"toasts\""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue