Answer the question
In order to leave comments, you need to log in
Why does RSpec break on create method tests?
Good afternoon. There are integration tests on RSpec. When running tests, it displays the following message:
Failure/Error: ActionCable.server.broadcast "boards_channel_#{list_params[:board_id]}", serialized_data
SocketError:
getaddrinfo: Name does not resolve
def create
@list = List.new(list_params)
@board = Board.find(list_params[:board_id])
if @list.save
serialized_data = ActiveModelSerializers::Adapter::Json.new(
ListSerializer.new(@list)
).serializable_hash
ActionCable.server.broadcast "boards_channel_#{list_params[:board_id]}", serialized_data
render json: @list.to_json, status: :ok
end
end
it "create" do
params = {
title: "Sample list",
board_id: board.id
}
post api_v1_lists_path(list: params)
expect(response).to have_http_status(:ok)
end
FactoryBot.define do
factory :list do
title { FFaker::Skill.specialty }
board
trait :within_board do
association :board
end
trait :with_cards do
after :create do |list|
cards = create_list :card, rand(0..5), list: list
end
end
end
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question