Skip to content
Snippets Groups Projects
Commit 682e354d authored by James Lopez's avatar James Lopez
Browse files

add spec

parent 1b7c1867
No related branches found
No related tags found
No related merge requests found
require 'spec_helper' require 'spec_helper'
   
describe Gitlab::CycleAnalytics::EventsQuery do describe Gitlab::CycleAnalytics::BaseEventFetcher do
let(:max_events) { 3 } let(:max_events) { 2 }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user, :admin) } 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 before do
allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return(Issue.all) 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 end
   
it 'limits the rows to the max number' do it 'limits the rows to the max number' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment