summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-01-08 19:14:05 +0900
committerShinya Maeda <shinya@gitlab.com>2019-01-09 14:40:38 +0900
commit50768a25ece480f48729985ad0f606ac73eb23fe (patch)
tree7ff0aeb6aa3c75c7cad1814b3b9b29447ae8e87c /spec/models
parentba5a9033cfefe72897c7e0e13950011a9dee8e80 (diff)
downloadgitlab-ce-50768a25ece480f48729985ad0f606ac73eb23fe.tar.gz
Add uniqueness validation to url column in Releases::Link model
Add test Add changelog
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/releases/link_spec.rb10
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