diff options
author | James Lopez <james@jameslopez.es> | 2016-04-20 11:56:28 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-04-20 11:56:28 +0300 |
commit | af18cddddf4ecb402ac613ddcc1f313f6adb7aad (patch) | |
tree | 02395653f7c79013b3c894e776c158f2bfeba672 /spec/models/concerns/issuable_spec.rb | |
parent | 8619208b644f2acdc30ccf36209ac56527bb4188 (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.rb | 26 |
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 |