Rename `Appendable::Reaction` to `Reaction`

This commit is contained in:
Andreas Nedbal 2023-10-26 05:54:48 +02:00 committed by Andreas Nedbal
parent 6dbc57ddc3
commit 1e29d3f86f
17 changed files with 144 additions and 145 deletions

View File

@ -4,7 +4,7 @@ class Answer < ApplicationRecord
belongs_to :user, counter_cache: :answered_count
belongs_to :question, counter_cache: :answer_count
has_many :comments, dependent: :destroy
has_many :smiles, class_name: "Appendable::Reaction", foreign_key: :parent_id, dependent: :destroy
has_many :smiles, class_name: "Reaction", foreign_key: :parent_id, dependent: :destroy
has_many :subscriptions, dependent: :destroy
has_many :comment_smiles, through: :comments, source: :smiles

View File

@ -1,6 +0,0 @@
# frozen_string_literal: true
class Appendable < ApplicationRecord
belongs_to :parent, polymorphic: true
belongs_to :user
end

View File

@ -3,7 +3,7 @@ class Comment < ApplicationRecord
belongs_to :answer, counter_cache: :comment_count
validates :user_id, presence: true
validates :answer_id, presence: true
has_many :smiles, class_name: "Appendable::Reaction", foreign_key: :parent_id, dependent: :destroy
has_many :smiles, class_name: "Reaction", foreign_key: :parent_id, dependent: :destroy
validates :content, length: { maximum: 512 }

View File

@ -1,6 +1,9 @@
# frozen_string_literal: true
class Appendable::Reaction < Appendable
class Reaction < ApplicationRecord
belongs_to :parent, polymorphic: true
belongs_to :user
# rubocop:disable Rails/SkipsModelValidations
after_create do
Notification.notify parent.user, self unless parent.user == user

View File

@ -34,7 +34,7 @@ class User < ApplicationRecord
has_many :answers, dependent: :destroy_async
has_many :comments, dependent: :destroy_async
has_many :inboxes, dependent: :destroy_async
has_many :smiles, class_name: "Appendable::Reaction", dependent: :destroy_async
has_many :smiles, class_name: "Reaction", dependent: :destroy_async
has_many :notifications, foreign_key: :recipient_id, dependent: :destroy_async
has_many :reports, dependent: :destroy_async
has_many :lists, dependent: :destroy_async

View File

@ -7,13 +7,13 @@ module User::ReactionMethods
raise Errors::ReactingSelfBlockedOther if self.blocking?(item.user)
raise Errors::ReactingOtherBlockedSelf if item.user.blocking?(self)
::Appendable::Reaction.create!(user: self, parent: item, content: "🙂")
Reaction.create!(user: self, parent: item, content: "🙂")
end
# unsmile an answer or comment
# @param item [ApplicationRecord] the answer/comment to unsmile
def unsmile(item)
::Appendable::Reaction.find_by(user: self, parent: item).destroy
Reaction.find_by(user: self, parent: item).destroy
end
def smiled?(item)

View File

@ -29,8 +29,7 @@ RailsAdmin.config do |config|
end
config.included_models = %w[
Appendable
Appendable::Reaction
Reaction
Answer
AnonymousBlock
Comment
@ -58,8 +57,7 @@ RailsAdmin.config do |config|
{
"AnonymousBlock" => "user-secret",
"Answer" => "exclamation",
"Appendable" => "paperclip",
"Appendable::Reaction" => "smile",
"Reaction" => "smile",
"Comment" => "comment",
"Inbox" => "inbox",
"List" => "list",

View File

@ -0,0 +1,6 @@
class RenameAppendableToReaction < ActiveRecord::Migration[7.0]
def change
rename_table :appendables, :reactions
remove_column :reactions, :type
end
end

View File

@ -10,8 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2023_10_18_172518) do
ActiveRecord::Schema[7.0].define(version: 2023_10_26_032527) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -19,11 +18,11 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.text "content", null: false
t.string "link_text"
t.string "link_href"
t.datetime "starts_at", null: false
t.datetime "ends_at", null: false
t.datetime "starts_at", precision: nil, null: false
t.datetime "ends_at", precision: nil, null: false
t.bigint "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["user_id"], name: "index_announcements_on_user_id"
end
@ -31,8 +30,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.bigint "user_id"
t.string "identifier"
t.bigint "question_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "target_user_id"
t.index ["identifier"], name: "index_anonymous_blocks_on_identifier"
t.index ["question_id"], name: "index_anonymous_blocks_on_question_id"
@ -45,34 +44,22 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.bigint "question_id"
t.integer "comment_count", default: 0, null: false
t.bigint "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.integer "smile_count", default: 0, null: false
t.datetime "pinned_at"
t.datetime "pinned_at", precision: nil
t.index ["created_at"], name: "index_answers_on_created_at", order: :desc
t.index ["question_id"], name: "index_answers_on_question_id"
t.index ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at"
t.index ["user_id", "pinned_at"], name: "index_answers_on_user_id_and_pinned_at"
end
create_table "appendables", force: :cascade do |t|
t.string "type", null: false
t.bigint "user_id", null: false
t.bigint "parent_id", null: false
t.string "parent_type", null: false
t.text "content"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["parent_id", "parent_type"], name: "index_appendables_on_parent_id_and_parent_type"
t.index ["user_id", "created_at"], name: "index_appendables_on_user_id_and_created_at"
end
create_table "comments", id: :bigint, default: -> { "gen_timestamp_id('comments'::text)" }, force: :cascade do |t|
t.string "content"
t.bigint "answer_id"
t.bigint "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.integer "smile_count", default: 0, null: false
t.index ["answer_id"], name: "index_comments_on_answer_id"
t.index ["user_id", "created_at"], name: "index_comments_on_user_id_and_created_at"
@ -82,8 +69,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.bigint "user_id"
t.bigint "question_id"
t.boolean "new"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.index ["question_id"], name: "index_inboxes_on_question_id"
t.index ["user_id"], name: "index_inboxes_on_user_id"
end
@ -91,8 +78,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
create_table "list_members", id: :serial, force: :cascade do |t|
t.integer "list_id", null: false
t.bigint "user_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.index ["list_id", "user_id"], name: "index_list_members_on_list_id_and_user_id", unique: true
end
@ -101,16 +88,16 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.string "name"
t.string "display_name"
t.boolean "private", default: true
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.index ["user_id", "name"], name: "index_lists_on_user_id_and_name", unique: true
end
create_table "mute_rules", id: :bigint, default: -> { "gen_timestamp_id('mute_rules'::text)" }, force: :cascade do |t|
t.bigint "user_id"
t.string "muted_phrase"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["user_id"], name: "index_mute_rules_on_user_id"
end
@ -119,8 +106,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.bigint "target_id"
t.bigint "recipient_id"
t.boolean "new"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.string "type", null: false
t.index ["new"], name: "index_notifications_on_new"
t.index ["recipient_id"], name: "index_notifications_on_recipient_id"
@ -134,8 +121,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.string "location", default: "", null: false
t.string "website", default: "", null: false
t.string "motivation_header", default: "", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.string "anon_display_name"
t.boolean "allow_long_questions", default: false
t.index ["user_id"], name: "index_profiles_on_user_id"
@ -146,18 +133,29 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.boolean "author_is_anonymous"
t.string "author_identifier"
t.bigint "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.integer "answer_count", default: 0, null: false
t.boolean "direct", default: false, null: false
t.index ["user_id", "created_at"], name: "index_questions_on_user_id_and_created_at"
end
create_table "reactions", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "parent_id", null: false
t.string "parent_type", null: false
t.text "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["parent_id", "parent_type"], name: "index_reactions_on_parent_id_and_parent_type"
t.index ["user_id", "created_at"], name: "index_reactions_on_user_id_and_created_at"
end
create_table "relationships", id: :serial, force: :cascade do |t|
t.bigint "source_id"
t.bigint "target_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.string "type", null: false
t.index ["source_id", "target_id", "type"], name: "index_relationships_on_source_id_and_target_id_and_type", unique: true
t.index ["source_id"], name: "index_relationships_on_source_id"
@ -169,8 +167,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.string "type", null: false
t.bigint "target_id", null: false
t.bigint "user_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.boolean "deleted", default: false
t.string "reason"
t.index ["type", "target_id"], name: "index_reports_on_type_and_target_id"
@ -181,8 +179,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.string "name"
t.string "resource_type"
t.bigint "resource_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
t.index ["resource_type", "resource_id"], name: "index_roles_on_resource_type_and_resource_id"
end
@ -193,14 +191,14 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.text "certificate"
t.string "password"
t.integer "connections", default: 1, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "type", null: false
t.string "auth_key"
t.string "client_id"
t.string "client_secret"
t.string "access_token"
t.datetime "access_token_expiration"
t.datetime "access_token_expiration", precision: nil
t.text "apn_key"
t.string "apn_key_id"
t.string "team_id"
@ -210,9 +208,9 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
create_table "rpush_feedback", force: :cascade do |t|
t.string "device_token"
t.datetime "failed_at", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.datetime "failed_at", precision: nil, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "app_id"
t.index ["device_token"], name: "index_rpush_feedback_on_device_token"
end
@ -225,14 +223,14 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.text "data"
t.integer "expiry", default: 86400
t.boolean "delivered", default: false, null: false
t.datetime "delivered_at"
t.datetime "delivered_at", precision: nil
t.boolean "failed", default: false, null: false
t.datetime "failed_at"
t.datetime "failed_at", precision: nil
t.integer "error_code"
t.text "error_description"
t.datetime "deliver_after"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.datetime "deliver_after", precision: nil
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "alert_is_json", default: false, null: false
t.string "type", null: false
t.string "collapse_key"
@ -241,7 +239,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.integer "app_id", null: false
t.integer "retries", default: 0
t.string "uri"
t.datetime "fail_after"
t.datetime "fail_after", precision: nil
t.boolean "processing", default: false, null: false
t.integer "priority"
t.text "url_args"
@ -259,8 +257,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
create_table "subscriptions", id: :serial, force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "answer_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["user_id", "answer_id"], name: "index_subscriptions_on_user_id_and_answer_id"
end
@ -282,8 +280,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.integer "background_color", default: 15789556
t.integer "body_text", default: 0
t.integer "muted_text", default: 7107965
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.integer "input_color", default: 15789556, null: false
t.integer "input_text", default: 0, null: false
t.integer "raised_accent", default: 16250871
@ -304,25 +302,25 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
create_table "user_bans", force: :cascade do |t|
t.bigint "user_id"
t.string "reason"
t.datetime "expires_at"
t.datetime "expires_at", precision: nil
t.bigint "banned_by_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "users", id: :bigint, default: -> { "gen_timestamp_id('users'::text)" }, force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "reset_password_sent_at", precision: nil
t.datetime "remember_created_at", precision: nil
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.datetime "current_sign_in_at", precision: nil
t.datetime "last_sign_in_at", precision: nil
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.string "screen_name"
t.integer "asked_count", default: 0, null: false
t.integer "answered_count", default: 0, null: false
@ -347,13 +345,13 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.integer "profile_header_h"
t.string "locale", default: "en"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.datetime "confirmed_at", precision: nil
t.datetime "confirmation_sent_at", precision: nil
t.string "unconfirmed_email"
t.boolean "show_foreign_themes", default: true, null: false
t.string "export_url"
t.boolean "export_processing", default: false, null: false
t.datetime "export_created_at"
t.datetime "export_created_at", precision: nil
t.string "otp_secret_key"
t.integer "otp_module", default: 0, null: false
t.boolean "privacy_lock_inbox", default: false
@ -363,8 +361,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
t.boolean "sharing_enabled", default: false
t.boolean "sharing_autoclose", default: false
t.string "sharing_custom_url"
t.datetime "notifications_updated_at"
t.datetime "inbox_updated_at"
t.datetime "notifications_updated_at", precision: nil
t.datetime "inbox_updated_at", precision: nil
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
@ -382,8 +380,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do
create_table "web_push_subscriptions", force: :cascade do |t|
t.bigint "user_id", null: false
t.json "subscription"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "failures", default: 0
t.index ["user_id"], name: "index_web_push_subscriptions_on_user_id"
end

View File

@ -7,7 +7,7 @@ require "zip/filesystem"
# require all data export use cases via Zeitwerk
# rubocop:disable Lint/Void
UseCase::DataExport::Answers
UseCase::DataExport::Appendables
UseCase::DataExport::Reactions
UseCase::DataExport::Comments
UseCase::DataExport::MuteRules
UseCase::DataExport::Questions

View File

@ -1,23 +0,0 @@
# frozen_string_literal: true
module UseCase
module DataExport
class Appendables < UseCase::DataExport::Base
def files = {
"appendables.json" => json_file!(
appendables: [
*user.smiles.map(&method(:collect_appendable))
]
)
}
def collect_appendable(appendable)
{}.tap do |h|
column_names(::Appendable).each do |field|
h[field] = appendable[field]
end
end
end
end
end
end

View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
module UseCase
module DataExport
class Reactions < UseCase::DataExport::Base
def files = {
"reactions.json" => json_file!(
reactions: [
*user.smiles.map(&method(:collect_reaction))
]
)
}
def collect_reaction(reaction)
{}.tap do |h|
column_names(::Reaction).each do |field|
h[field] = reaction[field]
end
end
end
end
end
end

View File

@ -28,8 +28,8 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "creates a smile to the answer" do
expect { subject }.to(change { Appendable::Reaction.count }.by(1))
expect(answer.reload.smiles.ids).to include(Appendable::Reaction.last.id)
expect { subject }.to(change { Reaction.count }.by(1))
expect(answer.reload.smiles.ids).to include(Reaction.last.id)
end
include_examples "returns the expected response"
@ -47,7 +47,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "does not create a smile" do
expect { subject }.not_to(change { Appendable::Reaction.count })
expect { subject }.not_to(change { Reaction.count })
end
include_examples "returns the expected response"
@ -100,7 +100,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "does not create a smile" do
expect { subject }.not_to(change { Appendable::Reaction.count })
expect { subject }.not_to(change { Reaction.count })
end
include_examples "returns the expected response"
@ -124,7 +124,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "does not create a smile" do
expect { subject }.not_to(change { Appendable::Reaction.count })
expect { subject }.not_to(change { Reaction.count })
end
include_examples "returns the expected response"
@ -160,7 +160,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "deletes the smile" do
expect { subject }.to(change { Appendable::Reaction.count }.by(-1))
expect { subject }.to(change { Reaction.count }.by(-1))
end
include_examples "returns the expected response"
@ -219,8 +219,8 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "creates a smile to the comment" do
expect { subject }.to(change { Appendable::Reaction.count }.by(1))
expect(comment.reload.smiles.ids).to include(Appendable::Reaction.last.id)
expect { subject }.to(change { Reaction.count }.by(1))
expect(comment.reload.smiles.ids).to include(Reaction.last.id)
end
include_examples "returns the expected response"
@ -238,7 +238,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "does not create a smile" do
expect { subject }.not_to(change { Appendable::Reaction.count })
expect { subject }.not_to(change { Reaction.count })
end
include_examples "returns the expected response"
@ -304,7 +304,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do
end
it "deletes the smile" do
expect { subject }.to(change { Appendable::Reaction.count }.by(-1))
expect { subject }.to(change { Reaction.count }.by(-1))
end
include_examples "returns the expected response"

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
FactoryBot.define do
factory :comment_smile, class: Appendable::Reaction do
factory :comment_smile, class: Reaction do
user { FactoryBot.build(:user) }
parent { FactoryBot.build(:comment) }
content { "🙂" }

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
FactoryBot.define do
factory :smile, class: Appendable::Reaction do
factory :smile, class: Reaction do
user { FactoryBot.create(:user) }
parent { FactoryBot.create(:answer, user: FactoryBot.create(:user)) }
content { "🙂" }

View File

@ -2,14 +2,14 @@
require "rails_helper"
describe UseCase::DataExport::Appendables, :data_export do
describe UseCase::DataExport::Reactions, :data_export do
include ActiveSupport::Testing::TimeHelpers
context "when user doesn't have any appendable" do
it "returns an empty set of appendables" do
expect(json_file("appendables.json")).to eq(
context "when user doesn't have any reactions" do
it "returns an empty set of reactions" do
expect(json_file("reactions.json")).to eq(
{
appendables: []
reactions: []
}
)
end
@ -19,32 +19,32 @@ describe UseCase::DataExport::Appendables, :data_export do
let(:answer) { FactoryBot.create(:answer, user:) }
let(:comment) { FactoryBot.create(:comment, user:, answer:) }
let!(:appendables) do
let!(:reactions) do
[
travel_to(Time.utc(2022, 12, 10, 13, 37, 42)) { FactoryBot.create(:comment_smile, user:, parent: comment) },
travel_to(Time.utc(2022, 12, 10, 13, 39, 21)) { FactoryBot.create(:smile, user:, parent: answer) }
]
end
it "returns the appendables as json" do
expect(json_file("appendables.json")).to eq(
it "returns the reactions as json" do
expect(json_file("reactions.json")).to eq(
{
appendables: [
reactions: [
{
id: appendables[0].id,
type: "Appendable::Reaction",
id: reactions[0].id,
type: "Reaction",
user_id: user.id,
parent_id: appendables[0].parent_id,
parent_id: reactions[0].parent_id,
parent_type: "Comment",
content: "🙂",
created_at: "2022-12-10T13:37:42.000Z",
updated_at: "2022-12-10T13:37:42.000Z"
},
{
id: appendables[1].id,
type: "Appendable::Reaction",
id: reactions[1].id,
type: "Reaction",
user_id: user.id,
parent_id: appendables[1].parent_id,
parent_id: reactions[1].parent_id,
parent_type: "Answer",
content: "🙂",
created_at: "2022-12-10T13:39:21.000Z",

View File

@ -2,7 +2,7 @@
require "rails_helper"
describe Appendable::Reaction do
describe Reaction do
let(:user) { FactoryBot.create(:user) }
let(:owner) { FactoryBot.create(:user) }
let(:parent) { FactoryBot.create(:answer, user: owner) }