diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-12-21 23:30:50 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-12-21 23:30:50 +0000 |
commit | 06cef29a62fbab4174b669a6d5e2059f1f5d8756 (patch) | |
tree | d7539e2836ff95ddeae32d5d351bb9d624e12037 /spec/helpers | |
parent | 88094c44f5dc5d88f378a9c3a055687a7d09e6f1 (diff) | |
parent | 95aae95a1cbb55facd127c74d6c044b13533f3fe (diff) | |
download | gitlab-ce-06cef29a62fbab4174b669a6d5e2059f1f5d8756.tar.gz |
Merge branch '44984-use-serializer-for-issuable-sidebar' into 'master'
Resolve "Create a serializer to render issuables sidebar"
Closes #44984
See merge request gitlab-org/gitlab-ce!23379
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index 4af98bc3678..81231cca085 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -43,16 +43,19 @@ describe IssuablesHelper do end describe '#issuable_labels_tooltip' do + let(:label_entity) { LabelEntity.represent(label).as_json } + let(:label2_entity) { LabelEntity.represent(label2).as_json } + it 'returns label text with no labels' do expect(issuable_labels_tooltip([])).to eq("Labels") end it 'returns label text with labels within max limit' do - expect(issuable_labels_tooltip([label])).to eq(label.title) + expect(issuable_labels_tooltip([label_entity])).to eq(label[:title]) end it 'returns label text with labels exceeding max limit' do - expect(issuable_labels_tooltip([label, label2], limit: 1)).to eq("#{label.title}, and 1 more") + expect(issuable_labels_tooltip([label_entity, label2_entity], limit: 1)).to eq("#{label[:title]}, and 1 more") end end @@ -197,33 +200,4 @@ describe IssuablesHelper do expect(helper.issuable_initial_data(issue)).to eq(expected_data) end end - - describe '#selected_labels' do - context 'if label_name param is a string' do - it 'returns a new label with title' do - allow(helper).to receive(:params) - .and_return(ActionController::Parameters.new(label_name: 'test label')) - - labels = helper.selected_labels - - expect(labels).to be_an(Array) - expect(labels.size).to eq(1) - expect(labels.first.title).to eq('test label') - end - end - - context 'if label_name param is an array' do - it 'returns a new label with title for each element' do - allow(helper).to receive(:params) - .and_return(ActionController::Parameters.new(label_name: ['test label 1', 'test label 2'])) - - labels = helper.selected_labels - - expect(labels).to be_an(Array) - expect(labels.size).to eq(2) - expect(labels.first.title).to eq('test label 1') - expect(labels.second.title).to eq('test label 2') - end - end - end end |