diff options
author | James Lopez <james@jameslopez.es> | 2016-10-20 17:20:04 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 10:22:55 +0300 |
commit | ebd5ced7eb296ce10160021d8999d21b36b24da9 (patch) | |
tree | 710dc319adbcfdabb8297333d77f0626b33bcedc /spec/lib/gitlab/cycle_analytics | |
parent | 52e2729bf44ff3376071c2462679b46e9f67a44e (diff) |
Added test events specs and logic. Also fixed some SQL and refactored the pipeline worker spec.
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/events_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb index 4a329737c7e..404d9e6912c 100644 --- a/spec/lib/gitlab/cycle_analytics/events_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb @@ -55,7 +55,7 @@ describe Gitlab::CycleAnalytics::Events do end it 'has the total time' do - expect(subject.code_events.first['total_time']).to eq('2 days') + expect(subject.code_events.first['total_time']).to eq('less than a minute') end it 'has a title' do @@ -75,6 +75,28 @@ describe Gitlab::CycleAnalytics::Events do end end + describe '#test_events' do + let!(:context) { create(:issue, project: project, created_at: 2.days.ago) } + let(:merge_request) { MergeRequest.first } + let!(:pipeline) { create(:ci_pipeline, + ref: merge_request.source_branch, + sha: merge_request.diff_head_sha, + project: context.project) } + + before do + pipeline.run! + pipeline.succeed! + end + + it 'has the build info as a pipeline' do + expect(subject.test_events.first['pipeline']).to eq(pipeline) + end + + it 'has the total time' do + expect(subject.test_events.first['total_time']).to eq('less than a minute') + end + end + def setup(context) milestone = create(:milestone, project: project) context.update(milestone: milestone) |