diff options
author | Regis <boudinot.regis@yahoo.com> | 2016-11-29 09:36:55 -0600 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2016-11-29 09:36:55 -0600 |
commit | afc529673a7f7885effb75914b08e75998ae54dc (patch) | |
tree | 7ad5a30bda64417fdc65e0eea24731c525ea88a4 /spec/serializers | |
parent | 8a2be66b04c1bd6368425d75239ebf0611a07f0f (diff) | |
parent | a7a3636de2a82b34cf057207bd3ad419f3964b7e (diff) | |
download | gitlab-ce-afc529673a7f7885effb75914b08e75998ae54dc.tar.gz |
Merge branch 'master' into auto-pipelines-vue
Diffstat (limited to 'spec/serializers')
5 files changed, 9 insertions, 17 deletions
diff --git a/spec/serializers/analytics_build_entity_spec.rb b/spec/serializers/analytics_build_entity_spec.rb index 9ac6f20fd3c..c0b7e86b17c 100644 --- a/spec/serializers/analytics_build_entity_spec.rb +++ b/spec/serializers/analytics_build_entity_spec.rb @@ -7,7 +7,7 @@ describe AnalyticsBuildEntity do context 'build with an author' do let(:user) { create(:user) } - let(:build) { create(:ci_build, author: user) } + let(:build) { create(:ci_build, author: user, started_at: 2.hours.ago, finished_at: 1.hour.ago) } subject { entity.as_json } @@ -23,5 +23,13 @@ describe AnalyticsBuildEntity do expect(subject).not_to include(/token/) expect(subject).not_to include(/variables/) end + + it 'contains the right started at' do + expect(subject[:date]).to eq('about 2 hours ago') + end + + it 'contains the duration' do + expect(subject[:total_time]).to eq(hours: 1 ) + end end end diff --git a/spec/serializers/analytics_build_serializer_spec.rb b/spec/serializers/analytics_build_serializer_spec.rb index a0a9d9a5f12..f0551c78671 100644 --- a/spec/serializers/analytics_build_serializer_spec.rb +++ b/spec/serializers/analytics_build_serializer_spec.rb @@ -10,10 +10,6 @@ describe AnalyticsBuildSerializer do let(:resource) { create(:ci_build) } context 'when there is a single object provided' do - it 'it generates payload for single object' do - expect(json).to be_an_instance_of Hash - end - it 'contains important elements of analyticsBuild' do expect(json) .to include(:name, :branch, :short_sha, :date, :total_time, :url, :author) diff --git a/spec/serializers/analytics_issue_serializer_spec.rb b/spec/serializers/analytics_issue_serializer_spec.rb index 2842e1ba52f..6afbb2df35c 100644 --- a/spec/serializers/analytics_issue_serializer_spec.rb +++ b/spec/serializers/analytics_issue_serializer_spec.rb @@ -22,10 +22,6 @@ describe AnalyticsIssueSerializer do end context 'when there is a single object provided' do - it 'it generates payload for single object' do - expect(json).to be_an_instance_of Hash - end - it 'contains important elements of the issue' do expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author) end diff --git a/spec/serializers/analytics_merge_request_serializer_spec.rb b/spec/serializers/analytics_merge_request_serializer_spec.rb index 564207984df..cdfae27193f 100644 --- a/spec/serializers/analytics_merge_request_serializer_spec.rb +++ b/spec/serializers/analytics_merge_request_serializer_spec.rb @@ -23,10 +23,6 @@ describe AnalyticsMergeRequestSerializer do end context 'when there is a single object provided' do - it 'it generates payload for single object' do - expect(json).to be_an_instance_of Hash - end - it 'contains important elements of the merge request' do expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author, :state) end diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index 8f95c9250b0..b7ed4eb0239 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -27,10 +27,6 @@ describe EnvironmentSerializer do let(:deployable) { create(:ci_build) } let(:resource) { deployment.environment } - it 'it generates payload for single object' do - expect(json).to be_an_instance_of Hash - end - it 'contains important elements of environment' do expect(json) .to include(:name, :external_url, :environment_path, :last_deployment) |