mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 06:06:45 +00:00
Add coverage for account uniqueness
This commit is contained in:
parent
18deb11585
commit
86872a3681
|
@ -18,7 +18,7 @@ class Mention < ApplicationRecord
|
|||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
validates :account, uniqueness: { scope: :status }
|
||||
validates :account_id, uniqueness: { scope: :status_id }
|
||||
|
||||
scope :active, -> { where(silent: false) }
|
||||
scope :silent, -> { where(silent: true) }
|
||||
|
|
|
@ -7,4 +7,10 @@ RSpec.describe Mention do
|
|||
it { is_expected.to belong_to(:account).required }
|
||||
it { is_expected.to belong_to(:status).required }
|
||||
end
|
||||
|
||||
describe 'Validations' do
|
||||
subject { Fabricate.build :mention }
|
||||
|
||||
it { is_expected.to validate_uniqueness_of(:account_id).scoped_to(:status_id) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue