diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-31 16:36:28 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-17 15:10:12 -0200 |
commit | bde0202693508aa9eb3ce76876b1c64120d51ef3 (patch) | |
tree | e7844d9b4f3756bfdaa84a4ef334990f49bd5781 /spec/models/subscription_spec.rb | |
parent | 731946bad2df5b2b369db53d965061d71bf6be77 (diff) | |
download | gitlab-ce-bde0202693508aa9eb3ce76876b1c64120d51ef3.tar.gz |
Add unique index to subscriptions on subscribable and user and project
Diffstat (limited to 'spec/models/subscription_spec.rb')
-rw-r--r-- | spec/models/subscription_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/models/subscription_spec.rb b/spec/models/subscription_spec.rb index 6cd6e01d0c7..ab674958387 100644 --- a/spec/models/subscription_spec.rb +++ b/spec/models/subscription_spec.rb @@ -11,5 +11,11 @@ describe Subscription, models: true do it { is_expected.to validate_presence_of(:project) } it { is_expected.to validate_presence_of(:subscribable) } it { is_expected.to validate_presence_of(:user) } + + it 'validates uniqueness of project_id scoped to subscribable_id, subscribable_type, and user_id' do + create(:subscription) + + expect(subject).to validate_uniqueness_of(:project_id).scoped_to([:subscribable_id, :subscribable_type, :user_id]) + end end end |