summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb2
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb66
-rw-r--r--spec/services/spam_service_spec.rb2
3 files changed, 67 insertions, 3 deletions
diff --git a/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb b/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb
index f2cda999932..e03d87e9d49 100644
--- a/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb
+++ b/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb
@@ -34,7 +34,7 @@ describe AutoMerge::MergeWhenPipelineSucceedsService do
it { is_expected.to be_truthy }
- context 'when the head piipeline succeeded' do
+ context 'when the head pipeline succeeded' do
let(:pipeline_status) { :success }
it { is_expected.to be_falsy }
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index bdf4dcc3142..2876f7b5f59 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -940,7 +940,7 @@ describe Ci::CreatePipelineService do
expect(resource_group.resources.first.build).to eq(nil)
end
- context 'when resourc group key includes predefined variables' do
+ context 'when resource group key includes predefined variables' do
let(:resource_group_key) { '$CI_COMMIT_REF_NAME-$CI_JOB_NAME' }
it 'interpolates the variables into the key correctly' do
@@ -969,6 +969,70 @@ describe Ci::CreatePipelineService do
end
end
+ context 'with release' do
+ shared_examples_for 'a successful release pipeline' do
+ before do
+ stub_feature_flags(ci_release_generation: true)
+ stub_ci_pipeline_yaml_file(YAML.dump(config))
+ end
+
+ it 'is valid config' do
+ pipeline = execute_service
+ build = pipeline.builds.first
+ expect(pipeline).to be_kind_of(Ci::Pipeline)
+ expect(pipeline).to be_valid
+ expect(pipeline.yaml_errors).not_to be_present
+ expect(pipeline).to be_persisted
+ expect(build).to be_kind_of(Ci::Build)
+ expect(build.options).to eq(config[:release].except(:stage, :only).with_indifferent_access)
+ end
+ end
+
+ context 'simple example' do
+ it_behaves_like 'a successful release pipeline' do
+ let(:config) do
+ {
+ release: {
+ script: ["make changelog | tee release_changelog.txt"],
+ release: {
+ tag_name: "v0.06",
+ description: "./release_changelog.txt"
+ }
+ }
+ }
+ end
+ end
+ end
+
+ context 'example with all release metadata' do
+ it_behaves_like 'a successful release pipeline' do
+ let(:config) do
+ {
+ release: {
+ script: ["make changelog | tee release_changelog.txt"],
+ release: {
+ name: "Release $CI_TAG_NAME",
+ tag_name: "v0.06",
+ description: "./release_changelog.txt",
+ assets: {
+ links: [
+ {
+ name: "cool-app.zip",
+ url: "http://my.awesome.download.site/1.0-$CI_COMMIT_SHORT_SHA.zip"
+ },
+ {
+ url: "http://my.awesome.download.site/1.0-$CI_COMMIT_SHORT_SHA.exe"
+ }
+ ]
+ }
+ }
+ }
+ }
+ end
+ end
+ end
+ end
+
shared_examples 'when ref is protected' do
let(:user) { create(:user) }
diff --git a/spec/services/spam_service_spec.rb b/spec/services/spam_service_spec.rb
index 76f77583612..094684296b8 100644
--- a/spec/services/spam_service_spec.rb
+++ b/spec/services/spam_service_spec.rb
@@ -45,7 +45,7 @@ describe SpamService do
context 'when indicated as spam by akismet' do
shared_examples 'akismet spam' do
- it 'doesnt check as spam when request is missing' do
+ it "doesn't check as spam when request is missing" do
check_spam(issue, nil, false)
expect(issue).not_to be_spam