diff --git a/app/controllers/cards/comments/reactions_controller.rb b/app/controllers/cards/comments/reactions_controller.rb index fb0c4fa55..0a728fbb2 100644 --- a/app/controllers/cards/comments/reactions_controller.rb +++ b/app/controllers/cards/comments/reactions_controller.rb @@ -25,7 +25,7 @@ class Cards::Comments::ReactionsController < ApplicationController private def set_comment - @comment = Comment.belonging_to_card(@card).find(params[:comment_id]) + @comment = @card.comments.find(params[:comment_id]) end def broadcast_create(reaction) diff --git a/app/controllers/cards/comments_controller.rb b/app/controllers/cards/comments_controller.rb index 33437eb24..d437c53fa 100644 --- a/app/controllers/cards/comments_controller.rb +++ b/app/controllers/cards/comments_controller.rb @@ -5,7 +5,7 @@ class Cards::CommentsController < ApplicationController before_action :ensure_creatorship, only: %i[ edit update destroy ] def create - @card.capture Comment.new(comment_params) + @card.comments.create!(comment_params) end def show @@ -25,7 +25,7 @@ class Cards::CommentsController < ApplicationController private def set_comment - @comment = Comment.belonging_to_card(@card).find(params[:id]) + @comment = @card.comments.find(params[:id]) end def ensure_creatorship diff --git a/app/models/card.rb b/app/models/card.rb index 4344d89b1..ed97a9e53 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -1,11 +1,12 @@ class Card < ApplicationRecord - include Assignable, Colored, Engageable, Eventable, Golden, Mentions, - Messages, Pinnable, Closeable, Readable, Searchable, Staged, + include Assignable, Colored, Engageable, Eventable, Golden, + Mentions, Pinnable, Closeable, Readable, Searchable, Staged, Statuses, Taggable, Watchable belongs_to :collection, touch: true belongs_to :creator, class_name: "User", default: -> { Current.user } + has_many :comments, -> { chronologically }, dependent: :destroy has_one_attached :image, dependent: :purge_later has_markdown :description diff --git a/app/models/card/eventable.rb b/app/models/card/eventable.rb index 67c8fcff9..5fd0759fb 100644 --- a/app/models/card/eventable.rb +++ b/app/models/card/eventable.rb @@ -12,7 +12,7 @@ module Card::Eventable def event_was_created(event) transaction do - find_or_capture_event_summary.events << event + # find_or_capture_event_summary.events << event touch(:last_active_at) end end diff --git a/app/models/card/messages.rb b/app/models/card/messages.rb deleted file mode 100644 index 89579b78f..000000000 --- a/app/models/card/messages.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Card::Messages - extend ActiveSupport::Concern - - included do - has_many :messages, -> { chronologically }, dependent: :destroy - end - - def capture(messageable) - messages.create! messageable: messageable - end -end diff --git a/app/models/card/readable.rb b/app/models/card/readable.rb index b37538b9b..84db015ed 100644 --- a/app/models/card/readable.rb +++ b/app/models/card/readable.rb @@ -31,8 +31,4 @@ module Card::Readable def comment_mentions Mention.where(source: comments) end - - def comments - @comments ||= Comment.where(id: messages.comments.pluck(:messageable_id)) - end end diff --git a/app/models/card/searchable.rb b/app/models/card/searchable.rb index 2e01fef9b..f28e964cf 100644 --- a/app/models/card/searchable.rb +++ b/app/models/card/searchable.rb @@ -11,7 +11,7 @@ module Card::Searchable cards = Card.search(query).select(:id).to_sql comments = Comment.search(query).select(:id).to_sql - left_joins(:messages).where("cards.id in (#{cards}) or messages.messageable_id in (#{comments})").distinct + left_joins(:comments).where("cards.id in (#{cards}) or comments.id in (#{comments})").distinct else none end diff --git a/app/models/comment.rb b/app/models/comment.rb index a8cdf6bdc..f22d95b3e 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,5 +1,6 @@ class Comment < ApplicationRecord - include Eventable, Mentions, Messageable, Searchable + include Eventable, Mentions, Searchable + belongs_to :card, touch: true belongs_to :creator, class_name: "User", default: -> { Current.user } has_many :reactions, dependent: :delete_all @@ -7,12 +8,11 @@ class Comment < ApplicationRecord has_markdown :body searchable_by :body_plain_text, using: :comments_search_index, as: :body - # FIXME: Not a fan of this. Think all references to comment should come directly from the message. - scope :belonging_to_card, ->(card) { joins(:message).where(messages: { card_id: card.id }) } + scope :chronologically, -> { order created_at: :asc, id: :desc } after_create_commit :watch_card_by_creator - delegate :watch_by, to: :card + delegate :collection, :watch_by, to: :card def to_partial_path "cards/#{super}" diff --git a/app/models/concerns/messageable.rb b/app/models/concerns/messageable.rb deleted file mode 100644 index d3dbca06c..000000000 --- a/app/models/concerns/messageable.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Messageable - extend ActiveSupport::Concern - - TYPES = %w[ Comment EventSummary ] - - included do - has_one :message, as: :messageable, touch: true, dependent: :destroy - has_one :card, through: :message - - delegate :collection, to: :card - end -end diff --git a/app/models/event.rb b/app/models/event.rb index 1775e640a..443e9170b 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -4,7 +4,6 @@ class Event < ApplicationRecord belongs_to :collection belongs_to :creator, class_name: "User" belongs_to :eventable, polymorphic: true - belongs_to :summary, touch: true, class_name: "EventSummary", optional: true scope :chronologically, -> { order created_at: :asc, id: :desc } diff --git a/app/models/event_summary.rb b/app/models/event_summary.rb deleted file mode 100644 index f04841e66..000000000 --- a/app/models/event_summary.rb +++ /dev/null @@ -1,36 +0,0 @@ -class EventSummary < ApplicationRecord - include Messageable - - has_many :events, -> { chronologically }, dependent: :delete_all, inverse_of: :summary - - # FIXME: Consider persisting the body and compute at write time. - def body - events.map { |event| summarize(event) }.join(" ") - end - - private - delegate :time_ago_in_words, to: "ApplicationController.helpers" - - def summarize(event) - case event.action - when "card_assigned" - "Assigned to #{event.assignees.pluck(:name).to_sentence}." - when "card_unassigned" - "Unassigned from #{event.assignees.pluck(:name).to_sentence}." - when "card_staged" - "#{event.creator.name} moved this to '#{event.stage_name}'." - when "card_closed" - "Closed by #{ event.creator.name }" - when "card_unstaged" - "#{event.creator.name} removed this from '#{event.stage_name}'." - when "card_due_date_added" - "#{event.creator.name} set due date to #{event.particulars.dig('particulars', 'due_date').to_date.strftime('%B %-d')}." - when "card_due_date_changed" - "#{event.creator.name} changed due date to #{event.particulars.dig('particulars', 'due_date').to_date.strftime('%B %-d')}." - when "card_due_date_removed" - "#{event.creator.name} removed the date." - when "card_title_changed" - "#{event.creator.name} changed title from '#{event.particulars.dig('particulars', 'old_title')}' to '#{event.particulars.dig('particulars', 'new_title')}'." - end - end -end diff --git a/app/models/message.rb b/app/models/message.rb deleted file mode 100644 index 7d950b3b7..000000000 --- a/app/models/message.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Message < ApplicationRecord - belongs_to :card, touch: true - - delegated_type :messageable, types: Messageable::TYPES, inverse_of: :message, dependent: :destroy - - scope :chronologically, -> { order created_at: :asc, id: :desc } -end diff --git a/app/views/cards/_messages.html.erb b/app/views/cards/_messages.html.erb index fa554e2fb..0b68c6d55 100644 --- a/app/views/cards/_messages.html.erb +++ b/app/views/cards/_messages.html.erb @@ -1,5 +1,5 @@ <%= messages_tag(card) do %> - <%= render partial: "cards/messages/message", collection: card.messages, cached: true %> + <%= render partial: "cards/comments/comment", collection: card.comments, cached: true %> <%= render "cards/comments/new", card: card %>
diff --git a/app/views/cards/messages/_message.html.erb b/app/views/cards/messages/_message.html.erb deleted file mode 100644 index 54fa127cc..000000000 --- a/app/views/cards/messages/_message.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% cache message do %> - <%# Template Dependency: cards/comments/comment %> - <%# Template Dependency: event_summaries/event_summary %> - <%= render partial: message.messageable.to_partial_path, object: message.messageable %> -<% end %> diff --git a/db/migrate/20250429162506_flatten_messages_and_comments.rb b/db/migrate/20250429162506_flatten_messages_and_comments.rb new file mode 100644 index 000000000..0f2b0dcdf --- /dev/null +++ b/db/migrate/20250429162506_flatten_messages_and_comments.rb @@ -0,0 +1,19 @@ +class FlattenMessagesAndComments < ActiveRecord::Migration[8.1] + def change + add_reference :comments, :card, null: true, foreign_key: true + + execute <<~SQL + UPDATE comments + SET card_id = ( + SELECT messages.card_id + FROM messages + WHERE messages.messageable_type = 'Comment' + AND messages.messageable_id = comments.id + LIMIT 1 + ) + SQL + + change_column_null :comments, :card_id, false + drop_table :messages + end +end diff --git a/db/schema.rb b/db/schema.rb index fcdb52c28..fd0b0d793 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2025_04_25_092727) do +ActiveRecord::Schema[8.1].define(version: 2025_04_29_162506) do create_table "accesses", force: :cascade do |t| t.integer "collection_id", null: false t.datetime "created_at", null: false @@ -160,9 +160,11 @@ ActiveRecord::Schema[8.1].define(version: 2025_04_25_092727) do end create_table "comments", force: :cascade do |t| + t.integer "card_id", null: false t.datetime "created_at", null: false t.integer "creator_id", null: false t.datetime "updated_at", null: false + t.index ["card_id"], name: "index_comments_on_card_id" end create_table "creators_filters", id: false, force: :cascade do |t| @@ -228,16 +230,6 @@ ActiveRecord::Schema[8.1].define(version: 2025_04_25_092727) do t.index ["source_type", "source_id"], name: "index_mentions_on_source" end - create_table "messages", force: :cascade do |t| - t.integer "card_id", null: false - t.datetime "created_at", null: false - t.integer "messageable_id", null: false - t.string "messageable_type", null: false - t.datetime "updated_at", null: false - t.index ["card_id"], name: "index_messages_on_card_id" - t.index ["messageable_type", "messageable_id"], name: "index_messages_on_messageable", unique: true - end - create_table "notifications", force: :cascade do |t| t.datetime "created_at", null: false t.integer "creator_id" @@ -294,6 +286,7 @@ ActiveRecord::Schema[8.1].define(version: 2025_04_25_092727) do t.datetime "created_at", null: false t.string "title" t.datetime "updated_at", null: false + t.index ["title"], name: "index_tags_on_account_id_and_title", unique: true end create_table "users", force: :cascade do |t| @@ -340,11 +333,11 @@ ActiveRecord::Schema[8.1].define(version: 2025_04_25_092727) do add_foreign_key "closures", "cards" add_foreign_key "closures", "users" add_foreign_key "collections", "workflows" + add_foreign_key "comments", "cards" add_foreign_key "events", "collections" add_foreign_key "events", "event_summaries", column: "summary_id" add_foreign_key "mentions", "users", column: "mentionee_id" add_foreign_key "mentions", "users", column: "mentioner_id" - add_foreign_key "messages", "cards" add_foreign_key "notifications", "users" add_foreign_key "notifications", "users", column: "creator_id" add_foreign_key "pins", "cards" diff --git a/db/schema_cache.yml b/db/schema_cache.yml index 3df7f5fe6..970285953 100644 --- a/db/schema_cache.yml +++ b/db/schema_cache.yml @@ -533,6 +533,7 @@ columns: - *22 - *18 comments: + - *21 - *5 - *23 - *6 @@ -701,31 +702,6 @@ columns: collation: comment: - *9 - messages: - - *21 - - *5 - - *6 - - !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column - auto_increment: - name: messageable_id - cast_type: *1 - sql_type_metadata: *2 - 'null': false - default: - default_function: - collation: - comment: - - !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column - auto_increment: - name: messageable_type - cast_type: *7 - sql_type_metadata: *8 - 'null': false - default: - default_function: - collation: - comment: - - *9 notifications: - *5 - !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column @@ -967,7 +943,6 @@ primary_keys: filters_stages: filters_tags: mentions: id - messages: id notifications: id pins: id reactions: id @@ -1005,7 +980,6 @@ data_sources: filters_stages: true filters_tags: true mentions: true - messages: true notifications: true pins: true reactions: true @@ -1492,7 +1466,23 @@ indexes: nulls_not_distinct: comment: valid: true - comments: [] + comments: + - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition + table: comments + name: index_comments_on_card_id + unique: false + columns: + - card_id + lengths: {} + orders: {} + opclasses: {} + where: + type: + using: + include: + nulls_not_distinct: + comment: + valid: true creators_filters: - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition table: creators_filters @@ -1728,40 +1718,6 @@ indexes: nulls_not_distinct: comment: valid: true - messages: - - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition - table: messages - name: index_messages_on_card_id - unique: false - columns: - - card_id - lengths: {} - orders: {} - opclasses: {} - where: - type: - using: - include: - nulls_not_distinct: - comment: - valid: true - - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition - table: messages - name: index_messages_on_messageable - unique: true - columns: - - messageable_type - - messageable_id - lengths: {} - orders: {} - opclasses: {} - where: - type: - using: - include: - nulls_not_distinct: - comment: - valid: true notifications: - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition table: notifications @@ -1967,7 +1923,23 @@ indexes: nulls_not_distinct: comment: valid: true - tags: [] + tags: + - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition + table: tags + name: index_tags_on_account_id_and_title + unique: true + columns: + - title + lengths: {} + orders: {} + opclasses: {} + where: + type: + using: + include: + nulls_not_distinct: + comment: + valid: true users: - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition table: users @@ -2052,4 +2024,4 @@ indexes: comment: valid: true workflows: [] -version: 20250425092727 +version: 20250429162506 diff --git a/test/controllers/cards/comments_controller_test.rb b/test/controllers/cards/comments_controller_test.rb index ab9c3822a..690cf0656 100644 --- a/test/controllers/cards/comments_controller_test.rb +++ b/test/controllers/cards/comments_controller_test.rb @@ -6,7 +6,7 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest end test "create" do - assert_difference "cards(:logo).messages.comments.count", +1 do + assert_difference -> { cards(:logo).comments.count }, +1 do post card_comments_path(cards(:logo), params: { comment: { body: "Agreed." } }) end diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml index 0f17c9760..ede5f327e 100644 --- a/test/fixtures/comments.yml +++ b/test/fixtures/comments.yml @@ -1,10 +1,40 @@ +logo_1: + card: logo + creator: system + created_at: <%= 1.week.ago %> + logo_agreement_jz: + card: logo creator: jz created_at: <%= 2.days.ago %> +logo_3: + card: logo + creator: system + created_at: <%= 1.day.ago %> + logo_agreement_kevin: + card: logo creator: kevin created_at: <%= 2.hours.ago %> +logo_5: + card: logo + creator: system + created_at: <%= 1.hour.ago %> + +layout_1: + card: layout + creator: system + layout_overflowing_david: + card: layout creator: david + +text_1: + card: text + creator: system + +shipping_1: + card: shipping + creator: system diff --git a/test/fixtures/event_summaries.yml b/test/fixtures/event_summaries.yml deleted file mode 100644 index dfe42afcb..000000000 --- a/test/fixtures/event_summaries.yml +++ /dev/null @@ -1,17 +0,0 @@ -logo_initial_activity: - created_at: <%= 1.week.ago %> - -logo_second_activity: - created_at: <%= 1.day.ago %> - -logo_third_activity: - created_at: <%= 1.hour.ago %> - -layout_initial_activity: - created_at: <%= 1.week.ago %> - -text_initial_activity: - created_at: <%= 1.week.ago %> - -shipping_initial_activity: - created_at: <%= 1.week.ago %> diff --git a/test/fixtures/events.yml b/test/fixtures/events.yml index 4bc273ca3..be738ef67 100644 --- a/test/fixtures/events.yml +++ b/test/fixtures/events.yml @@ -3,7 +3,6 @@ logo_published: collection: writebook eventable: logo (Card) action: card_published - summary: logo_initial_activity created_at: <%= 1.week.ago %> logo_assignment_jz: @@ -11,7 +10,6 @@ logo_assignment_jz: collection: writebook eventable: logo (Card) action: card_assigned - summary: logo_initial_activity particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:jz) ] }.to_json %> created_at: <%= 1.week.ago + 1.hour %> @@ -20,7 +18,6 @@ logo_assignment_km: collection: writebook eventable: logo (Card) action: card_assigned - summary: logo_second_activity particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:kevin) ] }.to_json %> created_at: <%= 1.day.ago %> @@ -29,7 +26,6 @@ layout_published: collection: writebook eventable: layout (Card) action: card_published - summary: layout_initial_activity created_at: <%= 1.week.ago %> layout_commented: @@ -37,7 +33,6 @@ layout_commented: collection: writebook eventable: layout_overflowing_david (Comment) action: comment_created - summary: layout_initial_activity created_at: <%= 1.week.ago %> layout_assignment_jz: @@ -45,7 +40,6 @@ layout_assignment_jz: collection: writebook eventable: layout (Card) action: card_assigned - summary: layout_initial_activity particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:jz) ] }.to_json %> created_at: <%= 1.hour.ago %> @@ -54,7 +48,6 @@ text_published: collection: writebook eventable: text (Card) action: card_published - summary: text_initial_activity created_at: <%= 1.week.ago %> shipping_published: @@ -62,7 +55,6 @@ shipping_published: collection: writebook eventable: shipping (Card) action: card_published - summary: shipping_initial_activity created_at: <%= 1.week.ago %> shipping_closed: @@ -70,5 +62,4 @@ shipping_closed: collection: writebook eventable: shipping (Card) action: card_closed - summary: shipping_initial_activity created_at: <%= 2.days.ago %> diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml deleted file mode 100644 index 443cc85a4..000000000 --- a/test/fixtures/messages.yml +++ /dev/null @@ -1,40 +0,0 @@ -logo_1: - card: logo - messageable: logo_initial_activity (EventSummary) - created_at: <%= 1.week.ago %> - -logo_2: - card: logo - messageable: logo_agreement_jz (Comment) - created_at: <%= 2.days.ago %> - -logo_3: - card: logo - messageable: logo_second_activity (EventSummary) - created_at: <%= 1.day.ago %> - -logo_4: - card: logo - messageable: logo_agreement_kevin (Comment) - created_at: <%= 2.hours.ago %> - -logo_5: - card: logo - messageable: logo_third_activity (EventSummary) - created_at: <%= 1.hour.ago %> - -layout_1: - card: layout - messageable: layout_initial_activity (EventSummary) - -layout_2: - card: layout - messageable: layout_overflowing_david (Comment) - -text_1: - card: text - messageable: text_initial_activity (EventSummary) - -shipping_1: - card: shipping - messageable: shipping_initial_activity (EventSummary) diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 7bcf86de4..d12c1a4b3 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -17,3 +17,7 @@ kevin: email_address: kevin@37signals.com password_digest: <%= digest %> role: admin + +system: + name: System + role: system diff --git a/test/models/card/commentable_test.rb b/test/models/card/commentable_test.rb index 5af8d6f37..1f82f4ccc 100644 --- a/test/models/card/commentable_test.rb +++ b/test/models/card/commentable_test.rb @@ -6,7 +6,7 @@ class Card::CommentableTest < ActiveSupport::TestCase assert_not cards(:text).watched_by?(users(:kevin)) with_current_user(:kevin) do - cards(:text).capture Comment.new(body: "This sounds interesting!") + cards(:text).comments.create!(body: "This sounds interesting!") end assert cards(:text).watched_by?(users(:kevin)) diff --git a/test/models/card/messages_test.rb b/test/models/card/messages_test.rb index 31d730306..fc8bc3509 100644 --- a/test/models/card/messages_test.rb +++ b/test/models/card/messages_test.rb @@ -4,6 +4,6 @@ class Card::MessagesTest < ActiveSupport::TestCase test "creating a card does not create a message by default" do card = collections(:writebook).cards.create! creator: users(:kevin), title: "New" - assert_empty card.messages + assert_empty card.comments end end diff --git a/test/models/card_test.rb b/test/models/card_test.rb index 39add0d99..dac35aa3d 100644 --- a/test/models/card_test.rb +++ b/test/models/card_test.rb @@ -6,11 +6,11 @@ class CardTest < ActiveSupport::TestCase end test "capturing messages" do - assert_difference "cards(:logo).messages.comments.count", +1 do - cards(:logo).capture Comment.new(body: "Agreed.") + assert_difference -> { cards(:logo).comments.count }, +1 do + cards(:logo).comments.create!(body: "Agreed.") end - assert_equal "Agreed.", cards(:logo).messages.comments.last.messageable.body.to_plain_text.chomp + assert_equal "Agreed.", cards(:logo).comments.last.body.to_plain_text.chomp end test "assignment states" do @@ -21,7 +21,7 @@ class CardTest < ActiveSupport::TestCase test "assignment toggling" do assert cards(:logo).assigned_to?(users(:kevin)) - assert_difference({ "cards(:logo).assignees.count" => -1, "Event.count" => +1 }) do + assert_difference({ -> { cards(:logo).assignees.count } => -1, -> { Event.count } => +1 }) do cards(:logo).toggle_assignment users(:kevin) end assert_not cards(:logo).assigned_to?(users(:kevin)) @@ -98,8 +98,8 @@ class CardTest < ActiveSupport::TestCase test "mentioning" do card = collections(:writebook).cards.create! title: "Insufficient haggis", creator: users(:kevin) - cards(:logo).capture Comment.new(body: "I hate haggis") - cards(:text).capture Comment.new(body: "I love haggis") + cards(:logo).comments.create!(body: "I hate haggis") + cards(:text).comments.create!(body: "I love haggis") assert_equal [ card, cards(:logo), cards(:text) ].sort, Card.mentioning("haggis").sort end diff --git a/test/models/comment_test.rb b/test/models/comment_test.rb index ae7b505a2..7af13ed36 100644 --- a/test/models/comment_test.rb +++ b/test/models/comment_test.rb @@ -6,8 +6,8 @@ class CommentTest < ActiveSupport::TestCase end test "searchable by body" do - message = cards(:logo).capture Comment.new(body: "I'd prefer something more rustic") + comment = cards(:logo).comments.create!(body: "I'd prefer something more rustic") - assert_includes Comment.search("something rustic"), message.comment + assert_includes Comment.search("something rustic"), comment end end diff --git a/test/models/event_summary_test.rb b/test/models/event_summary_test.rb deleted file mode 100644 index 84ba368ef..000000000 --- a/test/models/event_summary_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require "test_helper" - -class EventSummaryTest < ActiveSupport::TestCase - test "body" do - assert_equal " Assigned to JZ.", event_summaries(:logo_initial_activity).body - assert_equal "Assigned to Kevin.", event_summaries(:logo_second_activity).body - end -end diff --git a/test/models/filter_test.rb b/test/models/filter_test.rb index bdbc919ab..3605c28a1 100644 --- a/test/models/filter_test.rb +++ b/test/models/filter_test.rb @@ -7,8 +7,8 @@ class FilterTest < ActiveSupport::TestCase @new_card = @new_collection.cards.create! @new_card.update!(stage: workflow_stages(:qa_on_hold)) - cards(:layout).capture Comment.new(body: "I hate haggis") - cards(:logo).capture Comment.new(body: "I love haggis") + cards(:layout).comments.create!(body: "I hate haggis") + cards(:logo).comments.create!(body: "I love haggis") cards(:logo).update(stage: workflow_stages(:qa_on_hold)) end