summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/cycle_analytics
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-03 15:41:46 +0100
committerJames Lopez <james@jameslopez.es>2016-11-17 08:22:56 +0100
commit1b5b2eac222cc25bfe7301cdefb69a6635ef0682 (patch)
tree318480e1ebd2749cc233b1b4595d91f37376533f /spec/lib/gitlab/cycle_analytics
parent8f7266cd4b6a3e65224b55c2b91509f5ac88d837 (diff)
downloadgitlab-ce-1b5b2eac222cc25bfe7301cdefb69a6635ef0682.tar.gz
added missing fields to plan events and updated spec
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
-rw-r--r--spec/lib/gitlab/cycle_analytics/events_spec.rb28
1 files changed, 19 insertions, 9 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb
index e4535f467ec..80a66693a37 100644
--- a/spec/lib/gitlab/cycle_analytics/events_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb
@@ -4,6 +4,7 @@ describe Gitlab::CycleAnalytics::Events do
let(:project) { create(:project) }
let(:from_date) { 10.days.ago }
let(:user) { create(:user, :admin) }
+ let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
subject { described_class.new(project: project, from: from_date) }
@@ -12,8 +13,6 @@ describe Gitlab::CycleAnalytics::Events do
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
@@ -44,20 +43,32 @@ describe Gitlab::CycleAnalytics::Events do
end
describe '#plan_events' do
- let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
+ it 'has a title' do
+ expect(subject.plan_events.first['title']).not_to be_nil
+ end
- it 'has the first referenced commit' do
- expect(subject.plan_events.first['commit'].message).to eq('commit message')
+ it 'has a sha short ID' do
+ expect(subject.plan_events.first['sha']).not_to be_nil
end
it 'has the total time' do
expect(subject.plan_events.first['total_time']).to eq('less than a minute')
end
+
+ it "has the author's URL" do
+ expect(subject.plan_events.first['author_profile_url']).not_to be_nil
+ end
+
+ it "has the author's avatar URL" do
+ expect(subject.plan_events.first['author_avatar_url']).not_to be_nil
+ end
+
+ it "has the author's name" do
+ expect(subject.plan_events.first['author_name']).not_to be_nil
+ end
end
describe '#code_events' do
- let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
-
before do
create_commit_referencing_issue(context)
end
@@ -88,7 +99,6 @@ describe Gitlab::CycleAnalytics::Events do
end
describe '#test_events' do
- let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
let(:merge_request) { MergeRequest.first }
let!(:pipeline) do
create(:ci_pipeline,
@@ -140,7 +150,6 @@ describe Gitlab::CycleAnalytics::Events do
end
describe '#staging_events' do
- let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
let(:merge_request) { MergeRequest.first }
let!(:pipeline) do
create(:ci_pipeline,
@@ -152,6 +161,7 @@ describe Gitlab::CycleAnalytics::Events do
before do
pipeline.run!
pipeline.succeed!
+
merge_merge_requests_closing_issue(context)
deploy_master
end