blob: 939ce7f578566642c6db10b7dd5cfaa13f3727d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Ci::Pipelines::UpdateMetadataService, feature_category: :continuous_integration do
subject(:execute) { described_class.new(pipeline, { name: name }).execute }
let(:name) { 'Some random pipeline name' }
context 'when pipeline has no name' do
let(:pipeline) { create(:ci_pipeline) }
it 'updates the name' do
expect { execute }.to change { pipeline.reload.name }.to(name)
end
end
context 'when pipeline has a name' do
let(:pipeline) { create(:ci_pipeline, name: 'Some other name') }
it 'updates the name' do
expect { execute }.to change { pipeline.reload.name }.to(name)
end
end
context 'when new name is too long' do
let(:pipeline) { create(:ci_pipeline) }
let(:name) { 'a' * 256 }
it 'does not update the name' do
expect { execute }.not_to change { pipeline.reload.name }
end
end
end
|