summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-06-07 11:36:41 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-06-13 09:53:54 +0200
commitd03e687882552cedaac2a493c9dbf4a3d98e0bac (patch)
treeeb7b75a677863e533a6b5defcfd1b1e70df08096 /spec/serializers
parent0a80e50492d77d9947f382b3d55cb602fd4ad2f8 (diff)
downloadgitlab-ce-d03e687882552cedaac2a493c9dbf4a3d98e0bac.tar.gz
Rename BuildEntity to JobEntity
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/build_details_entity_spec.rb4
-rw-r--r--spec/serializers/job_entity_spec.rb (renamed from spec/serializers/build_entity_spec.rb)43
2 files changed, 34 insertions, 13 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb
index e2511e8968c..d85677840be 100644
--- a/spec/serializers/build_details_entity_spec.rb
+++ b/spec/serializers/build_details_entity_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe BuildDetailsEntity do
set(:user) { create(:admin) }
- it 'inherits from BuildEntity' do
- expect(described_class).to be < BuildEntity
+ it 'inherits from JobEntity' do
+ expect(described_class).to be < JobEntity
end
describe '#as_json' do
diff --git a/spec/serializers/build_entity_spec.rb b/spec/serializers/job_entity_spec.rb
index e51ff9fc709..6a694576b4a 100644
--- a/spec/serializers/build_entity_spec.rb
+++ b/spec/serializers/job_entity_spec.rb
@@ -1,9 +1,9 @@
require 'spec_helper'
-describe BuildEntity do
+describe JobEntity do
let(:user) { create(:user) }
- let(:build) { create(:ci_build) }
- let(:project) { build.project }
+ let(:job) { create(:ci_build) }
+ let(:project) { job.project }
let(:request) { double('request') }
before do
@@ -12,12 +12,12 @@ describe BuildEntity do
end
let(:entity) do
- described_class.new(build, request: request)
+ described_class.new(job, request: request)
end
subject { entity.as_json }
- it 'contains paths to build page action' do
+ it 'contains paths to job page action' do
expect(subject).to include(:build_path)
end
@@ -27,7 +27,7 @@ describe BuildEntity do
end
it 'contains whether it is playable' do
- expect(subject[:playable]).to eq build.playable?
+ expect(subject[:playable]).to eq job.playable?
end
it 'contains timestamps' do
@@ -41,7 +41,7 @@ describe BuildEntity do
context 'when build is retryable' do
before do
- build.update(status: :failed)
+ job.update(status: :failed)
end
it 'contains cancel path' do
@@ -51,7 +51,7 @@ describe BuildEntity do
context 'when build is cancelable' do
before do
- build.update(status: :running)
+ job.update(status: :running)
end
it 'contains cancel path' do
@@ -59,7 +59,7 @@ describe BuildEntity do
end
end
- context 'when build is a regular build' do
+ context 'when job is a regular job' do
it 'does not contain path to play action' do
expect(subject).not_to include(:play_path)
end
@@ -69,8 +69,8 @@ describe BuildEntity do
end
end
- context 'when build is a manual action' do
- let(:build) { create(:ci_build, :manual) }
+ context 'when job is a manual action' do
+ let(:job) { create(:ci_build, :manual) }
context 'when user is allowed to trigger action' do
before do
@@ -99,4 +99,25 @@ describe BuildEntity do
end
end
end
+
+ context 'when job is generic commit status' do
+ let(:job) { create(:generic_commit_status, target_url: 'http://google.com') }
+
+ it 'contains paths to target action' do
+ expect(subject).to include(:build_path)
+ end
+
+ it 'does not contain paths to other action paths' do
+ expect(subject).not_to include(:retry_path, :cancel_path, :play_path)
+ end
+
+ it 'contains timestamps' do
+ expect(subject).to include(:created_at, :updated_at)
+ end
+
+ it 'contains details' do
+ expect(subject).to include :status
+ expect(subject[:status]).to include :icon, :favicon, :text, :label
+ end
+ end
end