mirror of https://github.com/tootsuite/mastodon
Add coverage for account uniqueness
parent
18deb11585
commit
86872a3681
|
@ -18,7 +18,7 @@ class Mention < ApplicationRecord
|
||||||
|
|
||||||
has_one :notification, as: :activity, dependent: :destroy
|
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 :active, -> { where(silent: false) }
|
||||||
scope :silent, -> { where(silent: true) }
|
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(:account).required }
|
||||||
it { is_expected.to belong_to(:status).required }
|
it { is_expected.to belong_to(:status).required }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'Validations' do
|
||||||
|
subject { Fabricate.build :mention }
|
||||||
|
|
||||||
|
it { is_expected.to validate_uniqueness_of(:account_id).scoped_to(:status_id) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue