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:
authorJames Lopez <james@jameslopez.es>2016-04-20 11:56:28 +0300
committerJames Lopez <james@jameslopez.es>2016-04-20 11:56:28 +0300
commitaf18cddddf4ecb402ac613ddcc1f313f6adb7aad (patch)
tree02395653f7c79013b3c894e776c158f2bfeba672 /spec/models/concerns/issuable_spec.rb
parent8619208b644f2acdc30ccf36209ac56527bb4188 (diff)
udpated a few things based on MR feedback. Also added model spec
Diffstat (limited to 'spec/models/concerns/issuable_spec.rb')
-rw-r--r--spec/models/concerns/issuable_spec.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index b16ccc6e305..dc7a9a10893 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -212,4 +212,28 @@ describe Issue, "Issuable" do
expect(issue.downvotes).to eq(1)
end
end
-end
+
+ describe ".with_label" do
+ let(:example_label) { 'test1' }
+ let(:example_labels) { ['test1', 'test2'] }
+
+ it 'finds issue with 1 label' do
+ setup_labels([example_label])
+
+ expect(Issue.with_label(example_label).count).to eq(1)
+ end
+
+ it 'finds issue with 2 labels' do
+ setup_labels(example_labels)
+
+ expect(Issue.with_label(example_labels).to_a.count).to eq(1)
+ end
+
+ def setup_labels(label_names)
+ labels = label_names.map do |label|
+ create(:label, project: issue.project, title: label)
+ end
+ issue.labels << labels
+ end
+ end
+end \ No newline at end of file