diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-01-08 13:14:05 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-01-09 08:40:38 +0300 |
commit | 50768a25ece480f48729985ad0f606ac73eb23fe (patch) | |
tree | 7ff0aeb6aa3c75c7cad1814b3b9b29447ae8e87c /spec/models/releases | |
parent | ba5a9033cfefe72897c7e0e13950011a9dee8e80 (diff) |
Add uniqueness validation to url column in Releases::Link model
Add test
Add changelog
Diffstat (limited to 'spec/models/releases')
-rw-r--r-- | spec/models/releases/link_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/releases/link_spec.rb b/spec/models/releases/link_spec.rb index e88c186cbb8..06ed1438688 100644 --- a/spec/models/releases/link_spec.rb +++ b/spec/models/releases/link_spec.rb @@ -31,6 +31,16 @@ describe Releases::Link do end.to raise_error(ActiveRecord::RecordInvalid) end end + + context 'when duplicate url is added to a release' do + let!(:link) { create(:release_link, url: 'http://gitlab.com', release: release) } + + it 'raises an error' do + expect do + create(:release_link, url: 'http://gitlab.com', release: release) + end.to raise_error(ActiveRecord::RecordInvalid) + end + end end describe '.sorted' do |