diff options
author | James Lopez <james@jameslopez.es> | 2016-11-04 15:59:27 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 08:22:57 +0100 |
commit | beeb64610e6a1907d6675b535659a519db129453 (patch) | |
tree | 18e2ba374e27cd66bc84b718d8ebc6a2349f351b /spec/lib/gitlab/cycle_analytics/events_spec.rb | |
parent | bd31f24c548878597322b34965789c88ff8d2dde (diff) | |
download | gitlab-ce-beeb64610e6a1907d6675b535659a519db129453.tar.gz |
Refactored staging events, added missing fields and fixed specs
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics/events_spec.rb')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/events_spec.rb | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb index a531c4c31b7..815e70ab6a8 100644 --- a/spec/lib/gitlab/cycle_analytics/events_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb @@ -171,16 +171,28 @@ describe Gitlab::CycleAnalytics::Events do expect(subject.review_events.first['iid']).to eq(context.iid.to_s) end + it 'has the URL' do + expect(subject.review_events.first['url']).not_to be_nil + end + + it 'has a state' do + expect(subject.review_events.first['state']).not_to be_nil + end + it 'has a created_at timestamp' do - expect(subject.review_events.first['created_at']).to end_with('ago') + expect(subject.review_events.first['opened_at']).not_to be_nil end - it "has the author's email" do - expect(subject.review_events.first['email']).to eq(MergeRequest.first.author.email) + it "has the author's URL" do + expect(subject.review_events.first['author_profile_url']).not_to be_nil + end + + it "has the author's avatar URL" do + expect(subject.review_events.first['author_avatar_url']).not_to be_nil end it "has the author's name" do - expect(subject.review_events.first['name']).to eq(MergeRequest.first.author.name) + expect(subject.review_events.first['author_name']).to eq(context.author.name) end end @@ -194,6 +206,9 @@ describe Gitlab::CycleAnalytics::Events do end before do + create(:ci_build, pipeline: pipeline, status: :success, author: user) + create(:ci_build, pipeline: pipeline, status: :success, author: user) + pipeline.run! pipeline.succeed! @@ -201,12 +216,45 @@ describe Gitlab::CycleAnalytics::Events do deploy_master end - it 'has the build info as a pipeline' do - expect(subject.staging_events.first['pipeline']).to eq(pipeline) + + it 'has the name' do + expect(subject.staging_events.first['name']).not_to be_nil + end + + it 'has the ID' do + expect(subject.staging_events.first['id']).not_to be_nil + end + + it 'has the URL' do + expect(subject.staging_events.first['url']).not_to be_nil + end + + it 'has the branch name' do + expect(subject.staging_events.first['branch']).not_to be_nil + end + + it 'has the branch URL' do + expect(subject.staging_events.first['branch_url']).not_to be_nil + end + + it 'has the short SHA' do + expect(subject.staging_events.first['sha']).not_to be_nil + end + + it 'has the commit URL' do + expect(subject.staging_events.first['commit_url']).not_to be_nil + end + + it 'has the date' do + expect(subject.staging_events.first['date']).not_to be_nil end it 'has the total time' do - expect(subject.staging_events.first['total_time']).to eq('less than a minute') + expect(subject.staging_events.first['total_time']).not_to be_nil + end + + it 'has the author name' do + expect(subject.staging_events.first['author_name']).not_to be_nil end end |