Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/board/publication.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Board::Publication < ApplicationRecord
belongs_to :account, default: -> { board.account }
belongs_to :board
belongs_to :board, touch: true
Comment thread
robzolkos marked this conversation as resolved.

has_secure_token :key
end
14 changes: 14 additions & 0 deletions test/models/board/publishable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ class Board::PublishableTest < ActiveSupport::TestCase
end
end

test "touch board when publication is created" do
assert_changes -> { boards(:writebook).reload.updated_at } do
boards(:writebook).publish
end
end

test "touch board when publication is destroyed" do
boards(:writebook).publish

assert_changes -> { boards(:writebook).reload.updated_at } do
boards(:writebook).unpublish
end
end

test "publish doesn't create duplicate publications" do
boards(:writebook).publish
original_publication = boards(:writebook).publication
Expand Down