Commit 682e354d authored by James Lopez's avatar James Lopez

add spec

parent 1b7c1867
require 'spec_helper'
describe Gitlab::CycleAnalytics::EventsQuery do
let(:max_events) { 3 }
describe Gitlab::CycleAnalytics::BaseEventFetcher do
let(:max_events) { 2 }
let(:project) { create(:project) }
let(:user) { create(:user, :admin) }
let(:options) { { from: 30.days.ago } }
let(:start_time_attrs) { Issue.arel_table[:created_at] }
let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] }
let(:options) { { start_time_attrs: start_time_attrs,
end_time_attrs: end_time_attrs,
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) }
subject do
described_class.new(project: project,
stage: :issue,
options: options).fetch
end
before do
allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return(Issue.all)
stub_const('Gitlab::CycleAnalytics::EventsQuery::MAX_EVENTS', max_events)
allow_any_instance_of(Gitlab::CycleAnalytics::BaseEventFetcher).to receive(:serialize) do |event|
event
end
stub_const('Gitlab::CycleAnalytics::BaseEventFetcher::MAX_EVENTS', max_events)
setup_events(count: 5)
setup_events(count: 3)
end
it 'limits the rows to the max number' do
......
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