diff options
author | James Lopez <james@jameslopez.es> | 2016-11-04 13:56:24 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 10:22:57 +0300 |
commit | eccb6a5e920920bda11104ca608e652f84a944bf (patch) | |
tree | bbe4c84faf28be3e7f73fb3ccffa8aae9b3f246d /spec/lib/gitlab/cycle_analytics | |
parent | 11bad33a4206e482ffac42d75a121182a52e0cb0 (diff) |
Refactored test events
Now test events return the builds instead a list of pipelines to avoid calling pipeline.builds per each and get the info. Also, added missing fields/data, URLs, and fixed specs in events spec.
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/events_spec.rb | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb index 32e7bd7b12c..c83dafbd256 100644 --- a/spec/lib/gitlab/cycle_analytics/events_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb @@ -112,16 +112,47 @@ describe Gitlab::CycleAnalytics::Events do end before do + create(:ci_build, pipeline: pipeline, status: :success) + create(:ci_build, pipeline: pipeline, status: :success) + pipeline.run! pipeline.succeed! end - it 'has the build info as a pipeline' do - expect(subject.test_events.first['pipeline']).to eq(pipeline) + it 'has the name' do + expect(subject.test_events.first['name']).not_to be_nil + end + + it 'has the ID' do + expect(subject.test_events.first['id']).not_to be_nil + end + + it 'has the URL' do + expect(subject.test_events.first['url']).not_to be_nil + end + + it 'has the branch name' do + expect(subject.test_events.first['branch']).not_to be_nil + end + + it 'has the branch URL' do + expect(subject.test_events.first['branch_url']).not_to be_nil + end + + it 'has the short SHA' do + expect(subject.test_events.first['sha']).not_to be_nil + end + + it 'has the commit URL' do + expect(subject.test_events.first['commit_url']).not_to be_nil + end + + it 'has the date' do + expect(subject.test_events.first['date']).not_to be_nil end it 'has the total time' do - expect(subject.test_events.first['total_time']).to eq('less than a minute') + expect(subject.test_events.first['total_time']).not_to be_nil end end |