Commit 2e54454e authored by James Lopez's avatar James Lopez

Add limit to the number of events showed in cycle analytics and spec

parent 178626ed
......@@ -80,6 +80,8 @@ class ChangelogEntry
unless options.dry_run
write
%x{git add #{file_path}}
amend_commit if options.amend
end
end
......
---
title: Add limit to the number of events showed in cycle analytics
merge_request:
author:
require 'spec_helper'
describe Gitlab::CycleAnalytics::EventsQuery do
let(:max_events) { 3 }
let(:project) { create(:project) }
let(:user) { create(:user, :admin) }
let(:options) { { from: 30.days.ago } }
let(:issue_event) do
Gitlab::CycleAnalytics::IssueEvent.new(project: project, options: options)
end
subject { described_class.new(project: project, options: options).execute(issue_event) }
before do
allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return(Issue.all)
stub_const('Gitlab::CycleAnalytics::EventsQuery::MAX_EVENTS', max_events)
setup_events(count: 5)
end
it 'limits the rows the max number' do
expect(subject.count).to eq(max_events)
end
def setup_events(count:)
count.times do
issue = create(:issue, project: project, created_at: 2.days.ago)
milestone = create(:milestone, project: project)
issue.update(milestone: milestone)
create_merge_request_closing_issue(issue)
end
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