Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-14 22:12:07 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 19:58:27 +0300
commit297892011330ecdd2fa7cbe47fbc6fd4f3b62171 (patch)
tree6cbbb21eae4f3fa3d28b33599a0ea87fbf0f34ec /spec/models/label_priority_spec.rb
parentde9d3915d249a59e65226f6dd2ebe1f50a47306e (diff)
Add LabelPriority model
Diffstat (limited to 'spec/models/label_priority_spec.rb')
-rw-r--r--spec/models/label_priority_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/label_priority_spec.rb b/spec/models/label_priority_spec.rb
new file mode 100644
index 00000000000..5f7fa3aa047
--- /dev/null
+++ b/spec/models/label_priority_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe LabelPriority, models: true do
+ describe 'relationships' do
+ it { is_expected.to belong_to(:project) }
+ it { is_expected.to belong_to(:label) }
+ end
+
+ describe 'validations' do
+ it { is_expected.to validate_presence_of(:project) }
+ it { is_expected.to validate_presence_of(:label) }
+ it { is_expected.to validate_presence_of(:priority) }
+ it { is_expected.to validate_numericality_of(:priority).only_integer.is_greater_than_or_equal_to(0) }
+
+ it 'validates uniqueness of label_id scoped to project_id' do
+ create(:label_priority)
+
+ expect(subject).to validate_uniqueness_of(:label_id).scoped_to(:project_id)
+ end
+ end
+end