diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-02 21:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-02 21:07:52 +0000 |
commit | 07f40d55abd429da44fccdd95185a5ee838132d1 (patch) | |
tree | b306d6d4991bd76ff3682e10f0ea92953e44eae2 /spec/rubocop | |
parent | 86461e8c72db13d6d334fd107d38aa1b021d030e (diff) | |
download | gitlab-ce-07f40d55abd429da44fccdd95185a5ee838132d1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r-- | spec/rubocop/check_graceful_task_spec.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/rubocop/check_graceful_task_spec.rb b/spec/rubocop/check_graceful_task_spec.rb index 0364820a602..c39a00470fd 100644 --- a/spec/rubocop/check_graceful_task_spec.rb +++ b/spec/rubocop/check_graceful_task_spec.rb @@ -62,25 +62,35 @@ RSpec.describe RuboCop::CheckGracefulTask do let(:adjusted_rubocop_status) { status_success } context 'with sufficient environment variables' do + let(:script) { 'scripts/slack' } let(:channel) { 'f_rubocop' } + let(:emoji) { 'rubocop' } + let(:user_name) { 'GitLab Bot' } + let(:job_name) { 'some job name' } + let(:job_url) { 'some job url' } + let(:docs_link) { 'https://docs.gitlab.com/ee/development/contributing/style_guides.html#silenced-offenses' } before do env = { 'CI_SLACK_WEBHOOK_URL' => 'webhook_url', - 'CI_JOB_NAME' => 'job_name', - 'CI_JOB_URL' => 'job_url' + 'CI_JOB_NAME' => job_name, + 'CI_JOB_URL' => job_url } stub_const('ENV', ENV.to_hash.update(env)) end it 'notifies slack' do - popen_args = ['scripts/slack', channel, kind_of(String), 'rubocop', kind_of(String)] popen_result = ['', 0] - expect(Gitlab::Popen).to receive(:popen).with(popen_args).and_return(popen_result) + allow(Gitlab::Popen).to receive(:popen).with(anything).and_return(popen_result) subject + message = a_kind_of(String).and include(job_name).and include(job_url).and include(docs_link) + + expect(Gitlab::Popen).to have_received(:popen) + .with([script, channel, message, emoji, user_name]) + expect(output.string).to include("Notifying Slack ##{channel}.") end |