blob: ef59e8abc588b2eb6627344c4251596a2eebc341 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
require 'spec_helper'
describe Gitlab::CycleAnalytics::Events do
let(:project) { create(:project) }
let(:from_date) { 10.days.ago }
let(:user) { create(:user, :admin) }
subject { described_class.new(project: project, from: from_date) }
before do
setup(context)
end
describe '#issue_events' do
let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
it 'has the total time' do
expect(subject.issue_events.first['total_time']).to eq('2 days')
end
it 'has a title' do
expect(subject.issue_events.first['title']).to eq(context.title)
end
it 'has an iid' do
expect(subject.issue_events.first['iid']).to eq(context.iid.to_s)
end
it 'has a created_at timestamp' do
expect(subject.issue_events.first['created_at']).to end_with('ago')
end
it "has the author's name" do
expect(subject.issue_events.first['name']).to eq(context.author.name)
end
end
describe '#plan_events' do
let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
xit 'has the first referenced commit' do
expect(subject.plan_events.first['commit']).to eq(project.commit)
end
it 'has the total time' do
expect(subject.plan_events.first['total_time']).to eq('2 days')
end
end
def setup(context)
milestone = create(:milestone, project: project)
context.update(milestone: milestone)
create_merge_request_closing_issue(context)
end
end
|