diff options
author | Stan Hu <stanhu@gmail.com> | 2016-10-25 09:04:38 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-10-25 09:06:14 +0300 |
commit | 02f835c105df6c46d5c73468eedf1e2b0a0793b5 (patch) | |
tree | 769ff2e9ab3dbea79e6204fb774cd2c741d2299f /spec/finders | |
parent | ce256c28f2012a9c20fd1872fa91214b402528bf (diff) |
Improve readability and add specs for label filtering
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/labels_finder_spec.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/finders/labels_finder_spec.rb b/spec/finders/labels_finder_spec.rb index eb8df8e2bb2..10cfb66ec1c 100644 --- a/spec/finders/labels_finder_spec.rb +++ b/spec/finders/labels_finder_spec.rb @@ -38,6 +38,14 @@ describe LabelsFinder do expect(finder.execute).to eq [group_label_2, group_label_3, project_label_1, group_label_1, project_label_2, project_label_4] end + + it 'returns labels available if nil title is supplied' do + group_2.add_developer(user) + # params[:title] will return `nil` regardless whether it is specified + finder = described_class.new(user, title: nil) + + expect(finder.execute).to eq [group_label_2, group_label_3, project_label_1, group_label_1, project_label_2, project_label_4] + end end context 'filtering by group_id' do @@ -71,13 +79,19 @@ describe LabelsFinder do expect(finder.execute).to eq [group_label_2] end - it 'returns no labels if empty titles are supplied' do + it 'returns no labels if empty title is supplied' do finder = described_class.new(user, title: []) expect(finder.execute).to be_empty end - it 'returns no labels if empty names are supplied' do + it 'returns no labels if blank title is supplied' do + finder = described_class.new(user, title: '') + + expect(finder.execute).to be_empty + end + + it 'returns no labels if empty name is supplied' do finder = described_class.new(user, name: []) expect(finder.execute).to be_empty |