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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-31 15:02:52 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-31 15:02:52 +0300
commit92673c2c63c5928279fdb1985357fa8596c97397 (patch)
tree9fad84a29dec0dac27eb49aa219d79095a36b481 /spec/models/ci
parent5623cb9a6eb0075306b1cecfd336c2b5ce997f19 (diff)
parentaacc611090c0ae1bdb703e675e9e3283d8609f70 (diff)
Merge branch 'master' into feature/gb/kubernetes-only-pipeline-jobs
* master: (275 commits) Decrease Metrics/PerceivedComplexity threshold to 17 Upgrade mail and nokogiri gems due to security issues Link out to stackoverflow answer on setting swappiness Document swappiness recomendations in the requirements doc Fix invalid attribute used for time-ago-tooltip component Update latest artifacts doc Add changelog entry for flipping verify_certificates Default LDAP config verify_certificates to true Update share project with groups docs remove accidental console.log from karma tests update specs to match reorganized monitoring components Remove tooltips from new sidebar Use `git update-ref --stdin -z` to delete refs Don't use public_send in destroy_conditionally! helper Remove unused expressions policy from ci/cd config Simplify code for appending strategies in CI/CD config Raise exception when simplifiable ci entry incomplete Add changelog entry Fix MySQL failure for emoji autocomplete max-width for lazy-loaded images (this was removed in the original MR through merge resolution most probably) ... Conflicts: lib/gitlab/ci/config/entry/policy.rb
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/build_spec.rb18
-rw-r--r--spec/models/ci/pipeline_spec.rb14
-rw-r--r--spec/models/ci/stage_spec.rb11
3 files changed, 40 insertions, 3 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 767f0ad9e65..0c35ad3c9d8 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -21,6 +21,16 @@ describe Ci::Build do
it { is_expected.to respond_to(:has_trace?) }
it { is_expected.to respond_to(:trace) }
+ describe 'callbacks' do
+ context 'when running after_create callback' do
+ it 'triggers asynchronous build hooks worker' do
+ expect(BuildHooksWorker).to receive(:perform_async)
+
+ create(:ci_build)
+ end
+ end
+ end
+
describe '.manual_actions' do
let!(:manual_but_created) { create(:ci_build, :manual, status: :created, pipeline: pipeline) }
let!(:manual_but_succeeded) { create(:ci_build, :manual, status: :success, pipeline: pipeline) }
@@ -1247,8 +1257,12 @@ describe Ci::Build do
context 'when build has user' do
let(:user_variables) do
- [{ key: 'GITLAB_USER_ID', value: user.id.to_s, public: true },
- { key: 'GITLAB_USER_EMAIL', value: user.email, public: true }]
+ [
+ { key: 'GITLAB_USER_ID', value: user.id.to_s, public: true },
+ { key: 'GITLAB_USER_EMAIL', value: user.email, public: true },
+ { key: 'GITLAB_USER_LOGIN', value: user.username, public: true },
+ { key: 'GITLAB_USER_NAME', value: user.name, public: true }
+ ]
end
before do
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 11838b1ee07..7898bdbe2ff 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Ci::Pipeline, :mailer do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ set(:project) { create(:project) }
let(:pipeline) do
create(:ci_empty_pipeline, status: :created, project: project)
@@ -159,6 +159,18 @@ describe Ci::Pipeline, :mailer do
end
end
+ describe '#predefined_variables' do
+ subject { pipeline.predefined_variables }
+
+ it { is_expected.to be_an(Array) }
+
+ it 'includes the defined keys' do
+ keys = subject.map { |v| v[:key] }
+
+ expect(keys).to include('CI_PIPELINE_ID', 'CI_CONFIG_PATH', 'CI_PIPELINE_SOURCE')
+ end
+ end
+
describe '#auto_canceled?' do
subject { pipeline.auto_canceled? }
diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb
index 74c9d6145e2..586d073eb5e 100644
--- a/spec/models/ci/stage_spec.rb
+++ b/spec/models/ci/stage_spec.rb
@@ -38,6 +38,17 @@ describe Ci::Stage, :models do
expect(stage.status).to eq 'success'
end
end
+
+ context 'when stage status is not defined' do
+ before do
+ stage.update_column(:status, nil)
+ end
+
+ it 'sets the default value' do
+ expect(described_class.find(stage.id).status)
+ .to eq 'created'
+ end
+ end
end
describe 'update_status' do