Commit bec4740f authored by Shinya Maeda's avatar Shinya Maeda

Fix the coding style

parent 328d1a93
require 'spec_helper' require 'spec_helper'
describe Ci::BuildMetadata do describe Ci::BuildMetadata do
it_behaves_like 'Unique enum values'
set(:user) { create(:user) } set(:user) { create(:user) }
set(:group) { create(:group, :access_requestable) } set(:group) { create(:group, :access_requestable) }
set(:project) { create(:project, :repository, group: group, build_timeout: 2000) } set(:project) { create(:project, :repository, group: group, build_timeout: 2000) }
...@@ -15,8 +17,6 @@ describe Ci::BuildMetadata do ...@@ -15,8 +17,6 @@ describe Ci::BuildMetadata do
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
let(:build_metadata) { build.metadata } let(:build_metadata) { build.metadata }
it_behaves_like 'Unique enum values'
describe '#update_timeout_state' do describe '#update_timeout_state' do
subject { build_metadata } subject { build_metadata }
......
...@@ -3,6 +3,8 @@ require 'spec_helper' ...@@ -3,6 +3,8 @@ require 'spec_helper'
describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
include ExclusiveLeaseHelpers include ExclusiveLeaseHelpers
it_behaves_like 'Unique enum values'
set(:build) { create(:ci_build, :running) } set(:build) { create(:ci_build, :running) }
let(:chunk_index) { 0 } let(:chunk_index) { 0 }
let(:data_store) { :redis } let(:data_store) { :redis }
...@@ -12,8 +14,6 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do ...@@ -12,8 +14,6 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
described_class.new(build: build, chunk_index: chunk_index, data_store: data_store, raw_data: raw_data) described_class.new(build: build, chunk_index: chunk_index, data_store: data_store, raw_data: raw_data)
end end
it_behaves_like 'Unique enum values'
before do before do
stub_feature_flags(ci_enable_live_trace: true) stub_feature_flags(ci_enable_live_trace: true)
stub_artifacts_object_storage stub_artifacts_object_storage
......
require 'spec_helper' require 'spec_helper'
describe Ci::JobArtifact do describe Ci::JobArtifact do
it_behaves_like 'Unique enum values'
let(:artifact) { create(:ci_job_artifact, :archive) } let(:artifact) { create(:ci_job_artifact, :archive) }
describe "Associations" do describe "Associations" do
...@@ -15,8 +17,6 @@ describe Ci::JobArtifact do ...@@ -15,8 +17,6 @@ describe Ci::JobArtifact do
it { is_expected.to delegate_method(:open).to(:file) } it { is_expected.to delegate_method(:open).to(:file) }
it { is_expected.to delegate_method(:exists?).to(:file) } it { is_expected.to delegate_method(:exists?).to(:file) }
it_behaves_like 'Unique enum values'
describe '.test_reports' do describe '.test_reports' do
subject { described_class.test_reports } subject { described_class.test_reports }
......
require 'spec_helper' require 'spec_helper'
describe Ci::Pipeline, :mailer do describe Ci::Pipeline, :mailer do
it_behaves_like 'Unique enum values'
let(:user) { create(:user) } let(:user) { create(:user) }
set(:project) { create(:project) } set(:project) { create(:project) }
...@@ -28,8 +30,6 @@ describe Ci::Pipeline, :mailer do ...@@ -28,8 +30,6 @@ describe Ci::Pipeline, :mailer do
it { is_expected.to respond_to :short_sha } it { is_expected.to respond_to :short_sha }
it { is_expected.to delegate_method(:full_path).to(:project).with_prefix } it { is_expected.to delegate_method(:full_path).to(:project).with_prefix }
it_behaves_like 'Unique enum values'
describe 'associations' do describe 'associations' do
it 'has a bidirectional relationship with projects' do it 'has a bidirectional relationship with projects' do
expect(described_class.reflect_on_association(:project).has_inverse?).to eq(:pipelines) expect(described_class.reflect_on_association(:project).has_inverse?).to eq(:pipelines)
......
require 'spec_helper' require 'spec_helper'
describe Ci::Stage, :models do describe Ci::Stage, :models do
let(:stage) { create(:ci_stage_entity) }
it_behaves_like 'Unique enum values' it_behaves_like 'Unique enum values'
let(:stage) { create(:ci_stage_entity) }
describe 'associations' do describe 'associations' do
before do before do
create(:ci_build, stage_id: stage.id) create(:ci_build, stage_id: stage.id)
......
require 'rails_helper' require 'rails_helper'
describe Clusters::Applications::Ingress do describe Clusters::Applications::Ingress do
it_behaves_like 'Unique enum values'
let(:ingress) { create(:clusters_applications_ingress) } let(:ingress) { create(:clusters_applications_ingress) }
include_examples 'cluster application core specs', :clusters_applications_ingress include_examples 'cluster application core specs', :clusters_applications_ingress
include_examples 'cluster application status specs', :clusters_applications_ingress include_examples 'cluster application status specs', :clusters_applications_ingress
include_examples 'cluster application helm specs', :clusters_applications_ingress include_examples 'cluster application helm specs', :clusters_applications_ingress
it_behaves_like 'Unique enum values'
before do before do
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Clusters::Cluster do describe Clusters::Cluster do
it_behaves_like 'Unique enum values'
it { is_expected.to belong_to(:user) } it { is_expected.to belong_to(:user) }
it { is_expected.to have_many(:cluster_projects) } it { is_expected.to have_many(:cluster_projects) }
it { is_expected.to have_many(:projects) } it { is_expected.to have_many(:projects) }
...@@ -30,8 +32,6 @@ describe Clusters::Cluster do ...@@ -30,8 +32,6 @@ describe Clusters::Cluster do
it { is_expected.to respond_to :project } it { is_expected.to respond_to :project }
it_behaves_like 'Unique enum values'
describe '.enabled' do describe '.enabled' do
subject { described_class.enabled } subject { described_class.enabled }
......
...@@ -4,6 +4,8 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -4,6 +4,8 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
include KubernetesHelpers include KubernetesHelpers
include ReactiveCachingHelpers include ReactiveCachingHelpers
it_behaves_like 'Unique enum values'
it { is_expected.to belong_to(:cluster) } it { is_expected.to belong_to(:cluster) }
it { is_expected.to be_kind_of(Gitlab::Kubernetes) } it { is_expected.to be_kind_of(Gitlab::Kubernetes) }
it { is_expected.to be_kind_of(ReactiveCaching) } it { is_expected.to be_kind_of(ReactiveCaching) }
...@@ -18,8 +20,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -18,8 +20,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
it { is_expected.to delegate_method(:managed?).to(:cluster) } it { is_expected.to delegate_method(:managed?).to(:cluster) }
it { is_expected.to delegate_method(:kubernetes_namespace).to(:cluster) } it { is_expected.to delegate_method(:kubernetes_namespace).to(:cluster) }
it_behaves_like 'Unique enum values'
describe 'before_validation' do describe 'before_validation' do
context 'when namespace includes upper case' do context 'when namespace includes upper case' do
let(:kubernetes) { create(:cluster_platform_kubernetes, :configured, namespace: namespace) } let(:kubernetes) { create(:cluster_platform_kubernetes, :configured, namespace: namespace) }
......
require 'spec_helper' require 'spec_helper'
describe CommitStatus do describe CommitStatus do
it_behaves_like 'Unique enum values'
set(:project) { create(:project, :repository) } set(:project) { create(:project, :repository) }
set(:pipeline) do set(:pipeline) do
...@@ -29,8 +31,6 @@ describe CommitStatus do ...@@ -29,8 +31,6 @@ describe CommitStatus do
it { is_expected.to respond_to :running? } it { is_expected.to respond_to :running? }
it { is_expected.to respond_to :pending? } it { is_expected.to respond_to :pending? }
it_behaves_like 'Unique enum values'
describe '#author' do describe '#author' do
subject { commit_status.author } subject { commit_status.author }
......
require 'rails_helper' require 'rails_helper'
RSpec.describe GpgSignature do RSpec.describe GpgSignature do
it_behaves_like 'Unique enum values'
let(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } let(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' }
let!(:project) { create(:project, :repository, path: 'sample-project') } let!(:project) { create(:project, :repository, path: 'sample-project') }
let!(:commit) { create(:commit, project: project, sha: commit_sha) } let!(:commit) { create(:commit, project: project, sha: commit_sha) }
...@@ -8,8 +10,6 @@ RSpec.describe GpgSignature do ...@@ -8,8 +10,6 @@ RSpec.describe GpgSignature do
let(:gpg_key) { create(:gpg_key) } let(:gpg_key) { create(:gpg_key) }
let(:gpg_key_subkey) { create(:gpg_key_subkey) } let(:gpg_key_subkey) { create(:gpg_key_subkey) }
it_behaves_like 'Unique enum values'
describe 'associations' do describe 'associations' do
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:gpg_key) } it { is_expected.to belong_to(:gpg_key) }
......
require 'spec_helper' require 'spec_helper'
describe InternalId do describe InternalId do
it_behaves_like 'Unique enum values'
let(:project) { create(:project) } let(:project) { create(:project) }
let(:usage) { :issues } let(:usage) { :issues }
let(:issue) { build(:issue, project: project) } let(:issue) { build(:issue, project: project) }
...@@ -11,8 +13,6 @@ describe InternalId do ...@@ -11,8 +13,6 @@ describe InternalId do
it { is_expected.to validate_presence_of(:usage) } it { is_expected.to validate_presence_of(:usage) }
end end
it_behaves_like 'Unique enum values'
describe '.generate_next' do describe '.generate_next' do
subject { described_class.generate_next(issue, scope, usage, init) } subject { described_class.generate_next(issue, scope, usage, init) }
......
require 'rails_helper' require 'rails_helper'
describe List do describe List do
it_behaves_like 'Unique enum values'
describe 'relationships' do describe 'relationships' do
it { is_expected.to belong_to(:board) } it { is_expected.to belong_to(:board) }
it { is_expected.to belong_to(:label) } it { is_expected.to belong_to(:label) }
...@@ -21,8 +23,6 @@ describe List do ...@@ -21,8 +23,6 @@ describe List do
end end
end end
it_behaves_like 'Unique enum values'
describe '#destroy' do describe '#destroy' do
it 'can be destroyed when list_type is set to label' do it 'can be destroyed when list_type is set to label' do
subject = create(:list) subject = create(:list)
......
require 'rails_helper' require 'rails_helper'
RSpec.describe NotificationSetting do RSpec.describe NotificationSetting do
it_behaves_like 'Unique enum values'
describe "Associations" do describe "Associations" do
it { is_expected.to belong_to(:user) } it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:source) } it { is_expected.to belong_to(:source) }
end end
it_behaves_like 'Unique enum values'
describe "Validation" do describe "Validation" do
subject { described_class.new(source_id: 1, source_type: 'Project') } subject { described_class.new(source_id: 1, source_type: 'Project') }
......
require 'spec_helper' require 'spec_helper'
describe ProjectAutoDevops do describe ProjectAutoDevops do
it_behaves_like 'Unique enum values'
set(:project) { build(:project) } set(:project) { build(:project) }
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
...@@ -10,8 +12,6 @@ describe ProjectAutoDevops do ...@@ -10,8 +12,6 @@ describe ProjectAutoDevops do
it { is_expected.to respond_to(:created_at) } it { is_expected.to respond_to(:created_at) }
it { is_expected.to respond_to(:updated_at) } it { is_expected.to respond_to(:updated_at) }
it_behaves_like 'Unique enum values'
describe '#has_domain?' do describe '#has_domain?' do
context 'when domain is defined' do context 'when domain is defined' do
let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: 'domain.com') } let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: 'domain.com') }
......
...@@ -4,6 +4,8 @@ describe Project do ...@@ -4,6 +4,8 @@ describe Project do
include ProjectForksHelper include ProjectForksHelper
include GitHelpers include GitHelpers
it_behaves_like 'Unique enum values'
describe 'associations' do describe 'associations' do
it { is_expected.to belong_to(:group) } it { is_expected.to belong_to(:group) }
it { is_expected.to belong_to(:namespace) } it { is_expected.to belong_to(:namespace) }
...@@ -375,8 +377,6 @@ describe Project do ...@@ -375,8 +377,6 @@ describe Project do
end end
end end
it_behaves_like 'Unique enum values'
describe 'Respond to' do describe 'Respond to' do
it { is_expected.to respond_to(:url_to_repo) } it { is_expected.to respond_to(:url_to_repo) }
it { is_expected.to respond_to(:repo_exists?) } it { is_expected.to respond_to(:repo_exists?) }
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe PrometheusMetric do describe PrometheusMetric do
it_behaves_like 'Unique enum values'
subject { build(:prometheus_metric) } subject { build(:prometheus_metric) }
let(:other_project) { build(:project) } let(:other_project) { build(:project) }
...@@ -11,8 +13,6 @@ describe PrometheusMetric do ...@@ -11,8 +13,6 @@ describe PrometheusMetric do
it { is_expected.to validate_presence_of(:query) } it { is_expected.to validate_presence_of(:query) }
it { is_expected.to validate_presence_of(:group) } it { is_expected.to validate_presence_of(:group) }
it_behaves_like 'Unique enum values'
describe 'common metrics' do describe 'common metrics' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe ResourceLabelEvent, type: :model do RSpec.describe ResourceLabelEvent, type: :model do
it_behaves_like 'Unique enum values'
subject { build(:resource_label_event, issue: issue) } subject { build(:resource_label_event, issue: issue) }
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
it_behaves_like 'Unique enum values'
describe 'associations' do describe 'associations' do
it { is_expected.to belong_to(:user) } it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:issue) } 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