Commit db17b3c7 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge branch 'rs-issuables-list-metadata-shared-examples' into 'master'

Make the 'issuables list meta-data' shared example less dangerous

See merge request !13236
......@@ -106,7 +106,7 @@ def go(extra_params = {})
end
describe 'GET index' do
let!(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
def get_merge_requests(page = nil)
get :index,
......@@ -150,6 +150,8 @@ def get_merge_requests(page = nil)
context 'when filtering by opened state' do
context 'with opened merge requests' do
it 'lists those merge requests' do
expect(merge_request).to be_persisted
get_merge_requests
expect(assigns(:merge_requests)).to include(merge_request)
......
......@@ -11,10 +11,6 @@
end
@issuable_ids << issuable.id
issuable.id.times { create(:note, noteable: issuable, project: issuable.project) }
(issuable.id + 1).times { create(:award_emoji, :downvote, awardable: issuable) }
(issuable.id + 2).times { create(:award_emoji, :upvote, awardable: issuable) }
end
end
......@@ -27,10 +23,9 @@
meta_data = assigns(:issuable_meta_data)
@issuable_ids.each do |id|
expect(meta_data[id].notes_count).to eq(id)
expect(meta_data[id].downvotes).to eq(id + 1)
expect(meta_data[id].upvotes).to eq(id + 2)
aggregate_failures do
expect(meta_data.keys).to match_array(@issuable_ids)
expect(meta_data.values).to all(be_kind_of(Issuable::IssuableMeta))
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment