Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers/ci/lint/job_entity_spec.rb')
-rw-r--r--spec/serializers/ci/lint/job_entity_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/serializers/ci/lint/job_entity_spec.rb b/spec/serializers/ci/lint/job_entity_spec.rb
new file mode 100644
index 00000000000..2ef86cfd004
--- /dev/null
+++ b/spec/serializers/ci/lint/job_entity_spec.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::Lint::JobEntity, :aggregate_failures do
+ describe '#represent' do
+ let(:job) do
+ {
+ name: 'rspec',
+ stage: 'test',
+ before_script: ['bundle install', 'bundle exec rake db:create'],
+ script: ["rake spec"],
+ after_script: ["rake spec"],
+ tag_list: %w[ruby postgres],
+ environment: { name: 'hello', url: 'world' },
+ when: 'on_success',
+ allow_failure: false,
+ except: { refs: ["branches"] },
+ only: { refs: ["branches"] },
+ variables: { hello: 'world' }
+ }
+ end
+
+ subject(:serialized_job_result) { described_class.new(job).as_json }
+
+ it 'exposes job data' do
+ expect(serialized_job_result.keys).to contain_exactly(
+ :name,
+ :stage,
+ :before_script,
+ :script,
+ :after_script,
+ :tag_list,
+ :environment,
+ :when,
+ :allow_failure,
+ :only,
+ :except
+ )
+ expect(serialized_job_result.keys).not_to include(:variables)
+ end
+ end
+end