Commit cd2d101d authored by Kamil Trzciński's avatar Kamil Trzciński
Browse files

Merge branch 'check-unique-values-of-pipeline-enum' into 'master'

Check the uniqueness of the values of pipeline enum

See merge request gitlab-org/gitlab-ce!23504
......@@ -15,6 +15,8 @@
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:build_metadata) { build.metadata }
it_behaves_like 'having unique enum values'
describe '#update_timeout_state' do
subject { build_metadata }
......
......@@ -12,6 +12,8 @@
described_class.new(build: build, chunk_index: chunk_index, data_store: data_store, raw_data: raw_data)
end
it_behaves_like 'having unique enum values'
before do
stub_feature_flags(ci_enable_live_trace: true)
stub_artifacts_object_storage
......
......@@ -15,6 +15,8 @@
it { is_expected.to delegate_method(:open).to(:file) }
it { is_expected.to delegate_method(:exists?).to(:file) }
it_behaves_like 'having unique enum values'
describe '.test_reports' do
subject { described_class.test_reports }
......
......@@ -8,6 +8,8 @@
create(:ci_empty_pipeline, status: :created, project: project)
end
it_behaves_like 'having unique enum values'
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:auto_canceled_by) }
......
require 'spec_helper'
describe Ci::Runner do
it_behaves_like 'having unique enum values'
describe 'validation' do
it { is_expected.to validate_presence_of(:access_level) }
it { is_expected.to validate_presence_of(:runner_type) }
......
......@@ -3,6 +3,8 @@
describe Ci::Stage, :models do
let(:stage) { create(:ci_stage_entity) }
it_behaves_like 'having unique enum values'
describe 'associations' do
before do
create(:ci_build, stage_id: stage.id)
......
......@@ -3,6 +3,8 @@
describe Clusters::Applications::Ingress do
let(:ingress) { create(:clusters_applications_ingress) }
it_behaves_like 'having unique enum values'
include_examples 'cluster application core specs', :clusters_applications_ingress
include_examples 'cluster application status specs', :clusters_applications_ingress
include_examples 'cluster application helm specs', :clusters_applications_ingress
......
......@@ -3,6 +3,8 @@
require 'spec_helper'
describe Clusters::Cluster do
it_behaves_like 'having unique enum values'
it { is_expected.to belong_to(:user) }
it { is_expected.to have_many(:cluster_projects) }
it { is_expected.to have_many(:projects) }
......
......@@ -18,6 +18,8 @@
it { is_expected.to delegate_method(:managed?).to(:cluster) }
it { is_expected.to delegate_method(:kubernetes_namespace).to(:cluster) }
it_behaves_like 'having unique enum values'
describe 'before_validation' do
context 'when namespace includes upper case' do
let(:kubernetes) { create(:cluster_platform_kubernetes, :configured, namespace: namespace) }
......
......@@ -13,6 +13,8 @@ def create_status(**opts)
create(:commit_status, pipeline: pipeline, **opts)
end
it_behaves_like 'having unique enum values'
it { is_expected.to belong_to(:pipeline) }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:project) }
......
......@@ -16,6 +16,8 @@
it { is_expected.to validate_presence_of(:ref) }
it { is_expected.to validate_presence_of(:sha) }
it_behaves_like 'having unique enum values'
describe '#scheduled_actions' do
subject { deployment.scheduled_actions }
......
......@@ -8,6 +8,8 @@
let(:gpg_key) { create(:gpg_key) }
let(:gpg_key_subkey) { create(:gpg_key_subkey) }
it_behaves_like 'having unique enum values'
describe 'associations' do
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:gpg_key) }
......
......@@ -7,6 +7,8 @@
let(:scope) { { project: project } }
let(:init) { ->(s) { s.project.issues.size } }
it_behaves_like 'having unique enum values'
context 'validations' do
it { is_expected.to validate_presence_of(:usage) }
end
......
require 'rails_helper'
describe List do
it_behaves_like 'having unique enum values'
describe 'relationships' do
it { is_expected.to belong_to(:board) }
it { is_expected.to belong_to(:label) }
......
require 'rails_helper'
RSpec.describe NotificationSetting do
it_behaves_like 'having unique enum values'
describe "Associations" do
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:source) }
......
......@@ -3,6 +3,8 @@
describe ProjectAutoDevops do
set(:project) { build(:project) }
it_behaves_like 'having unique enum values'
it { is_expected.to belong_to(:project) }
it { is_expected.to define_enum_for(:deploy_strategy) }
......
......@@ -4,6 +4,8 @@
include ProjectForksHelper
include GitHelpers
it_behaves_like 'having unique enum values'
describe 'associations' do
it { is_expected.to belong_to(:group) }
it { is_expected.to belong_to(:namespace) }
......
......@@ -6,6 +6,8 @@
subject { build(:prometheus_metric) }
let(:other_project) { build(:project) }
it_behaves_like 'having unique enum values'
it { is_expected.to belong_to(:project) }
it { is_expected.to validate_presence_of(:title) }
it { is_expected.to validate_presence_of(:query) }
......
require 'spec_helper'
describe PushEventPayload do
it_behaves_like 'having unique enum values'
describe 'saving payloads' do
it 'does not allow commit messages longer than 70 characters' do
event = create(:push_event)
......
......@@ -7,6 +7,8 @@
let(:issue) { create(:issue) }
let(:merge_request) { create(:merge_request) }
it_behaves_like 'having unique enum values'
describe 'associations' do
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:issue) }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment