2016-09-07 05:23:01 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'CycleAnalytics#review', feature: true do
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:from_date) { 10.days.ago }
|
|
|
|
let(:user) { create(:user, :admin) }
|
|
|
|
subject { CycleAnalytics.new(project, from: from_date) }
|
|
|
|
|
|
|
|
generate_cycle_analytics_spec(phase: :review,
|
|
|
|
data_fn: -> (context) { { issue: context.create(:issue, project: context.project) } },
|
|
|
|
start_time_conditions: [["merge request that closes issue is created", -> (context, data) { context.create_merge_request_closing_issue(data[:issue]) }]],
|
2016-09-20 05:47:36 +00:00
|
|
|
end_time_conditions: [["merge request that closes issue is merged", -> (context, data) { context.merge_merge_requests_closing_issue(data[:issue]) }]],
|
|
|
|
post_fn: -> (context, data) { context.deploy_master })
|
2016-09-07 05:23:01 +00:00
|
|
|
|
|
|
|
context "when a regular merge request (that doesn't close the issue) is created and merged" do
|
|
|
|
it "returns nil" do
|
|
|
|
5.times do
|
|
|
|
MergeRequests::MergeService.new(project, user).execute(create(:merge_request))
|
2016-09-20 05:47:36 +00:00
|
|
|
|
|
|
|
deploy_master
|
2016-09-07 05:23:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
expect(subject.review).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|