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-07-27 22:32:32 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 18:58:57 +0300
commit611dab2e522e5e59cf09cd459a31686e65616863 (patch)
tree85e83a9fef746433ab5cdce643a147bc65f69311 /spec/models/list_spec.rb
parentfa576d38bb23e0f2804e3feba959e0c6191dbbb0 (diff)
Add Board model
Diffstat (limited to 'spec/models/list_spec.rb')
-rw-r--r--spec/models/list_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb
new file mode 100644
index 00000000000..7ad32047cb7
--- /dev/null
+++ b/spec/models/list_spec.rb
@@ -0,0 +1,28 @@
+require 'rails_helper'
+
+describe List do
+ describe 'relationships' do
+ it { is_expected.to belong_to(:board) }
+ it { is_expected.to belong_to(:label) }
+ end
+
+ describe 'validations' do
+ it { is_expected.to validate_presence_of(:board) }
+ it { is_expected.to validate_presence_of(:label) }
+ it { is_expected.to validate_presence_of(:list_type) }
+ it { is_expected.to validate_presence_of(:position) }
+ it { is_expected.to validate_numericality_of(:position).only_integer.is_greater_than_or_equal_to(0) }
+
+ it 'does not require label to be set when list_type is set to backlog' do
+ subject.list_type = :backlog
+
+ expect(subject).not_to validate_presence_of(:label)
+ end
+
+ it 'does not require label to be set when list_type is set to done' do
+ subject.list_type = :done
+
+ expect(subject).not_to validate_presence_of(:label)
+ end
+ end
+end