diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-05 08:43:27 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-04-05 08:43:27 +0000 |
commit | 4ec16912b8f4eba9cc70dd21afb65c441f857da0 (patch) | |
tree | 3ca18a8657e052ed4233e8e73cea1ab5e657ebfa /spec/models | |
parent | 2bf4fefd12aa9ff8a757f7de8280e11cdb68bc96 (diff) | |
download | gitlab-ce-4ec16912b8f4eba9cc70dd21afb65c441f857da0.tar.gz |
Autocorrect with RSpec/ExampleWording cop
- rewords examples starting with 'should'
- rewords examples starting with 'it'
Note: I had to manually fixup "onlies" to "only"
Diffstat (limited to 'spec/models')
27 files changed, 124 insertions, 124 deletions
diff --git a/spec/models/badge_spec.rb b/spec/models/badge_spec.rb index 314d7d1e9f4..c661f5384ea 100644 --- a/spec/models/badge_spec.rb +++ b/spec/models/badge_spec.rb @@ -61,7 +61,7 @@ describe Badge do end shared_examples 'rendered_links' do - it 'should use the project information to populate the url placeholders' do + it 'uses the project information to populate the url placeholders' do stub_project_commit_info(project) expect(badge.public_send("rendered_#{method}", project)).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever" diff --git a/spec/models/badges/project_badge_spec.rb b/spec/models/badges/project_badge_spec.rb index e683d110252..d41c5cf2ca1 100644 --- a/spec/models/badges/project_badge_spec.rb +++ b/spec/models/badges/project_badge_spec.rb @@ -14,7 +14,7 @@ describe ProjectBadge do end shared_examples 'rendered_links' do - it 'should use the badge project information to populate the url placeholders' do + it 'uses the badge project information to populate the url placeholders' do stub_project_commit_info(project) expect(badge.public_send("rendered_#{method}")).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever" diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 697fe3fda06..b9ece6a394a 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2726,13 +2726,13 @@ describe Ci::Build do project.deploy_tokens << deploy_token end - it 'should include deploy token variables' do + it 'includes deploy token variables' do is_expected.to include(*deploy_token_variables) end end context 'when gitlab-deploy-token does not exist' do - it 'should not include deploy token variables' do + it 'does not include deploy token variables' do expect(subject.find { |v| v[:key] == 'CI_DEPLOY_USER'}).to be_nil expect(subject.find { |v| v[:key] == 'CI_DEPLOY_PASSWORD'}).to be_nil end diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index b3ab63925dd..2cb581696a0 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -72,7 +72,7 @@ describe Ci::Runner do expect(instance_runner.errors.full_messages).to include('Runner cannot have projects assigned') end - it 'should fail to save a group assigned to a project runner even if the runner is already saved' do + it 'fails to save a group assigned to a project runner even if the runner is already saved' do group_runner expect { create(:group, runners: [project_runner]) } diff --git a/spec/models/clusters/applications/cert_manager_spec.rb b/spec/models/clusters/applications/cert_manager_spec.rb index af7eadfc74c..5cd80edb3a1 100644 --- a/spec/models/clusters/applications/cert_manager_spec.rb +++ b/spec/models/clusters/applications/cert_manager_spec.rb @@ -36,7 +36,7 @@ describe Clusters::Applications::CertManager do it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } - it 'should be initialized with cert_manager arguments' do + it 'is initialized with cert_manager arguments' do expect(subject.name).to eq('certmanager') expect(subject.chart).to eq('stable/cert-manager') expect(subject.version).to eq('v0.5.2') @@ -52,7 +52,7 @@ describe Clusters::Applications::CertManager do cert_manager.email = cert_email end - it 'should use his/her email to register issuer with certificate provider' do + it 'uses his/her email to register issuer with certificate provider' do expect(subject.files).to eq(cert_manager.files.merge(cluster_issuer_file)) end end @@ -68,7 +68,7 @@ describe Clusters::Applications::CertManager do context 'application failed to install previously' do let(:cert_manager) { create(:clusters_applications_cert_managers, :errored, version: '0.0.1') } - it 'should be initialized with the locked version' do + it 'is initialized with the locked version' do expect(subject.version).to eq('v0.5.2') end end @@ -80,7 +80,7 @@ describe Clusters::Applications::CertManager do subject { application.files } - it 'should include cert_manager specific keys in the values.yaml file' do + it 'includes cert_manager specific keys in the values.yaml file' do expect(values).to include('ingressShim') end end diff --git a/spec/models/clusters/applications/helm_spec.rb b/spec/models/clusters/applications/helm_spec.rb index f97d126d918..f177d493a2e 100644 --- a/spec/models/clusters/applications/helm_spec.rb +++ b/spec/models/clusters/applications/helm_spec.rb @@ -36,11 +36,11 @@ describe Clusters::Applications::Helm do it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InitCommand) } - it 'should be initialized with 1 arguments' do + it 'is initialized with 1 arguments' do expect(subject.name).to eq('helm') end - it 'should have cert files' do + it 'has cert files' do expect(subject.files[:'ca.pem']).to be_present expect(subject.files[:'ca.pem']).to eq(helm.ca_cert) diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb index 09e60b9a206..113d29b5551 100644 --- a/spec/models/clusters/applications/ingress_spec.rb +++ b/spec/models/clusters/applications/ingress_spec.rb @@ -73,7 +73,7 @@ describe Clusters::Applications::Ingress do it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } - it 'should be initialized with ingress arguments' do + it 'is initialized with ingress arguments' do expect(subject.name).to eq('ingress') expect(subject.chart).to eq('stable/nginx-ingress') expect(subject.version).to eq('1.1.2') @@ -92,7 +92,7 @@ describe Clusters::Applications::Ingress do context 'application failed to install previously' do let(:ingress) { create(:clusters_applications_ingress, :errored, version: 'nginx') } - it 'should be initialized with the locked version' do + it 'is initialized with the locked version' do expect(subject.version).to eq('1.1.2') end end @@ -104,7 +104,7 @@ describe Clusters::Applications::Ingress do subject { application.files } - it 'should include ingress valid keys in values' do + it 'includes ingress valid keys in values' do expect(values).to include('image') expect(values).to include('repository') expect(values).to include('stats') diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb index 5970a1959b5..1a7363b64f9 100644 --- a/spec/models/clusters/applications/jupyter_spec.rb +++ b/spec/models/clusters/applications/jupyter_spec.rb @@ -45,7 +45,7 @@ describe Clusters::Applications::Jupyter do it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } - it 'should be initialized with 4 arguments' do + it 'is initialized with 4 arguments' do expect(subject.name).to eq('jupyter') expect(subject.chart).to eq('jupyter/jupyterhub') expect(subject.version).to eq('0.9-174bbd5') @@ -65,7 +65,7 @@ describe Clusters::Applications::Jupyter do context 'application failed to install previously' do let(:jupyter) { create(:clusters_applications_jupyter, :errored, version: '0.0.1') } - it 'should be initialized with the locked version' do + it 'is initialized with the locked version' do expect(subject.version).to eq('0.9-174bbd5') end end @@ -77,7 +77,7 @@ describe Clusters::Applications::Jupyter do subject { application.files } - it 'should include valid values' do + it 'includes valid values' do expect(values).to include('ingress') expect(values).to include('hub') expect(values).to include('rbac') diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb index 25493689fbc..5e68f2634da 100644 --- a/spec/models/clusters/applications/knative_spec.rb +++ b/spec/models/clusters/applications/knative_spec.rb @@ -77,17 +77,17 @@ describe Clusters::Applications::Knative do end shared_examples 'a command' do - it 'should be an instance of Helm::InstallCommand' do + it 'is an instance of Helm::InstallCommand' do expect(subject).to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) end - it 'should be initialized with knative arguments' do + it 'is initialized with knative arguments' do expect(subject.name).to eq('knative') expect(subject.chart).to eq('knative/knative') expect(subject.files).to eq(knative.files) end - it 'should not install metrics for prometheus' do + it 'does not install metrics for prometheus' do expect(subject.postinstall).to be_nil end @@ -97,7 +97,7 @@ describe Clusters::Applications::Knative do subject { knative.install_command } - it 'should install metrics' do + it 'installs metrics' do expect(subject.postinstall).not_to be_nil expect(subject.postinstall.length).to be(1) expect(subject.postinstall[0]).to eql("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}") @@ -108,7 +108,7 @@ describe Clusters::Applications::Knative do describe '#install_command' do subject { knative.install_command } - it 'should be initialized with latest version' do + it 'is initialized with latest version' do expect(subject.version).to eq('0.3.0') end @@ -119,7 +119,7 @@ describe Clusters::Applications::Knative do let!(:current_installed_version) { knative.version = '0.1.0' } subject { knative.update_command } - it 'should be initialized with current version' do + it 'is initialized with current version' do expect(subject.version).to eq(current_installed_version) end @@ -132,7 +132,7 @@ describe Clusters::Applications::Knative do subject { application.files } - it 'should include knative specific keys in the values.yaml file' do + it 'includes knative specific keys in the values.yaml file' do expect(values).to include('domain') end end @@ -165,7 +165,7 @@ describe Clusters::Applications::Knative do synchronous_reactive_cache(knative) end - it 'should be able k8s core for pod details' do + it 'is able k8s core for pod details' do expect(knative.service_pod_details(namespace.namespace, cluster.cluster_project.project.name)).not_to be_nil end end @@ -190,7 +190,7 @@ describe Clusters::Applications::Knative do stub_kubeclient_service_pods end - it 'should have an unintialized cache' do + it 'has an unintialized cache' do is_expected.to be_nil end @@ -204,11 +204,11 @@ describe Clusters::Applications::Knative do synchronous_reactive_cache(knative) end - it 'should have cached services' do + it 'has cached services' do is_expected.not_to be_nil end - it 'should match our namespace' do + it 'matches our namespace' do expect(knative.services_for(ns: namespace)).not_to be_nil end end diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb index 82a502addd4..e8ba9737c23 100644 --- a/spec/models/clusters/applications/prometheus_spec.rb +++ b/spec/models/clusters/applications/prometheus_spec.rb @@ -94,7 +94,7 @@ describe Clusters::Applications::Prometheus do it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } - it 'should be initialized with 3 arguments' do + it 'is initialized with 3 arguments' do expect(subject.name).to eq('prometheus') expect(subject.chart).to eq('stable/prometheus') expect(subject.version).to eq('6.7.3') @@ -113,12 +113,12 @@ describe Clusters::Applications::Prometheus do context 'application failed to install previously' do let(:prometheus) { create(:clusters_applications_prometheus, :errored, version: '2.0.0') } - it 'should be initialized with the locked version' do + it 'is initialized with the locked version' do expect(subject.version).to eq('6.7.3') end end - it 'should not install knative metrics' do + it 'does not install knative metrics' do expect(subject.postinstall).to be_nil end @@ -128,7 +128,7 @@ describe Clusters::Applications::Prometheus do subject { prometheus.install_command } - it 'should install knative metrics' do + it 'installs knative metrics' do expect(subject.postinstall).to include("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}") end end @@ -142,7 +142,7 @@ describe Clusters::Applications::Prometheus do expect(prometheus.upgrade_command(values)).to be_an_instance_of(::Gitlab::Kubernetes::Helm::InstallCommand) end - it 'should be initialized with 3 arguments' do + it 'is initialized with 3 arguments' do command = prometheus.upgrade_command(values) expect(command.name).to eq('prometheus') @@ -180,7 +180,7 @@ describe Clusters::Applications::Prometheus do subject { application.files } - it 'should include prometheus valid values' do + it 'includes prometheus valid values' do expect(values).to include('alertmanager') expect(values).to include('kubeStateMetrics') expect(values).to include('nodeExporter') @@ -204,7 +204,7 @@ describe Clusters::Applications::Prometheus do expect(subject[:'values.yaml']).to eq({ hello: :world }) end - it 'should include cert files' do + it 'includes cert files' do expect(subject[:'ca.pem']).to be_present expect(subject[:'ca.pem']).to eq(application.cluster.application_helm.ca_cert) @@ -220,7 +220,7 @@ describe Clusters::Applications::Prometheus do application.cluster.application_helm.ca_cert = nil end - it 'should not include cert files' do + it 'does not include cert files' do expect(subject[:'ca.pem']).not_to be_present expect(subject[:'cert.pem']).not_to be_present expect(subject[:'key.pem']).not_to be_present diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb index 7e2f5835279..399a13f82cb 100644 --- a/spec/models/clusters/applications/runner_spec.rb +++ b/spec/models/clusters/applications/runner_spec.rb @@ -21,7 +21,7 @@ describe Clusters::Applications::Runner do it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } - it 'should be initialized with 4 arguments' do + it 'is initialized with 4 arguments' do expect(subject.name).to eq('runner') expect(subject.chart).to eq('runner/gitlab-runner') expect(subject.version).to eq('0.3.0') @@ -41,7 +41,7 @@ describe Clusters::Applications::Runner do context 'application failed to install previously' do let(:gitlab_runner) { create(:clusters_applications_runner, :errored, runner: ci_runner, version: '0.1.13') } - it 'should be initialized with the locked version' do + it 'is initialized with the locked version' do expect(subject.version).to eq('0.3.0') end end @@ -53,7 +53,7 @@ describe Clusters::Applications::Runner do subject { application.files } - it 'should include runner valid values' do + it 'includes runner valid values' do expect(values).to include('concurrent') expect(values).to include('checkInterval') expect(values).to include('rbac') @@ -131,7 +131,7 @@ describe Clusters::Applications::Runner do allow(application).to receive(:chart_values).and_return(stub_values) end - it 'should overwrite values.yaml' do + it 'overwrites values.yaml' do expect(values).to match(/privileged: '?#{application.privileged}/) end end diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb index fabd2806d9a..894ef3fb956 100644 --- a/spec/models/clusters/cluster_spec.rb +++ b/spec/models/clusters/cluster_spec.rb @@ -269,7 +269,7 @@ describe Clusters::Cluster do context 'when cluster is not a valid hostname' do let(:cluster) { build(:cluster, domain: 'http://not.a.valid.hostname') } - it 'should add an error on domain' do + it 'adds an error on domain' do expect(subject).not_to be_valid expect(subject.errors[:domain].first).to eq('contains invalid characters (valid characters: [a-z0-9\\-])') end @@ -599,7 +599,7 @@ describe Clusters::Cluster do stub_application_setting(auto_devops_domain: 'global_domain.com') end - it 'should include KUBE_INGRESS_BASE_DOMAIN' do + it 'includes KUBE_INGRESS_BASE_DOMAIN' do expect(subject.to_hash).to include(KUBE_INGRESS_BASE_DOMAIN: 'global_domain.com') end end @@ -607,7 +607,7 @@ describe Clusters::Cluster do context 'with a cluster domain' do let(:cluster) { create(:cluster, :provided_by_gcp, domain: 'example.com') } - it 'should include KUBE_INGRESS_BASE_DOMAIN' do + it 'includes KUBE_INGRESS_BASE_DOMAIN' do expect(subject.to_hash).to include(KUBE_INGRESS_BASE_DOMAIN: 'example.com') end end @@ -615,7 +615,7 @@ describe Clusters::Cluster do context 'with no domain' do let(:cluster) { create(:cluster, :provided_by_gcp, :project) } - it 'should return an empty array' do + it 'returns an empty array' do expect(subject.to_hash).to be_empty end end diff --git a/spec/models/clusters/kubernetes_namespace_spec.rb b/spec/models/clusters/kubernetes_namespace_spec.rb index 579f486f99f..b5cba80b806 100644 --- a/spec/models/clusters/kubernetes_namespace_spec.rb +++ b/spec/models/clusters/kubernetes_namespace_spec.rb @@ -60,7 +60,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do context 'when platform has a namespace assigned' do let(:namespace) { 'platform-namespace' } - it 'should copy the namespace' do + it 'copies the namespace' do subject expect(kubernetes_namespace.namespace).to eq('platform-namespace') @@ -72,7 +72,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do let(:namespace) { nil } let(:project_slug) { "#{project.path}-#{project.id}" } - it 'should fallback to project namespace' do + it 'fallbacks to project namespace' do subject expect(kubernetes_namespace.namespace).to eq(project_slug) @@ -83,7 +83,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do describe '#service_account_name' do let(:service_account_name) { "#{kubernetes_namespace.namespace}-service-account" } - it 'should set a service account name based on namespace' do + it 'sets a service account name based on namespace' do subject expect(kubernetes_namespace.service_account_name).to eq(service_account_name) diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index 14bec17a2bd..0281dd2c303 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -447,7 +447,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching let(:platform) { cluster.platform } context 'when namespace is updated' do - it 'should call ConfigureWorker' do + it 'calls ConfigureWorker' do expect(ClusterConfigureWorker).to receive(:perform_async).with(cluster.id).once platform.namespace = 'new-namespace' @@ -456,7 +456,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching end context 'when namespace is not updated' do - it 'should not call ConfigureWorker' do + it 'does not call ConfigureWorker' do expect(ClusterConfigureWorker).not_to receive(:perform_async) platform.username = "new-username" diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 259ac6852a8..27ed298ae08 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -659,7 +659,7 @@ describe Issuable do end context 'adding time' do - it 'should update the total time spent' do + it 'updates the total time spent' do spend_time(1800) expect(issue.total_time_spent).to eq(1800) @@ -679,7 +679,7 @@ describe Issuable do spend_time(1800) end - it 'should update the total time spent' do + it 'updates the total time spent' do spend_time(-900) expect(issue.total_time_spent).to eq(900) diff --git a/spec/models/concerns/spammable_spec.rb b/spec/models/concerns/spammable_spec.rb index 650d49e41a1..67353475251 100644 --- a/spec/models/concerns/spammable_spec.rb +++ b/spec/models/concerns/spammable_spec.rb @@ -12,7 +12,7 @@ describe Spammable do end describe 'ClassMethods' do - it 'should return correct attr_spammable' do + it 'returns correct attr_spammable' do expect(issue.spammable_text).to eq("#{issue.title}\n#{issue.description}") end end @@ -20,7 +20,7 @@ describe Spammable do describe 'InstanceMethods' do let(:issue) { build(:issue, spam: true) } - it 'should be invalid if spam' do + it 'is invalid if spam' do expect(issue.valid?).to be_falsey end diff --git a/spec/models/deploy_token_spec.rb b/spec/models/deploy_token_spec.rb index 05320703e25..2fe82eaa778 100644 --- a/spec/models/deploy_token_spec.rb +++ b/spec/models/deploy_token_spec.rb @@ -9,7 +9,7 @@ describe DeployToken do it { is_expected.to have_many(:projects).through(:project_deploy_tokens) } describe '#ensure_token' do - it 'should ensure a token' do + it 'ensures a token' do deploy_token.token = nil deploy_token.save @@ -19,13 +19,13 @@ describe DeployToken do describe '#ensure_at_least_one_scope' do context 'with at least one scope' do - it 'should be valid' do + it 'is valid' do is_expected.to be_valid end end context 'with no scopes' do - it 'should be invalid' do + it 'is invalid' do deploy_token = build(:deploy_token, read_repository: false, read_registry: false) expect(deploy_token).not_to be_valid @@ -36,13 +36,13 @@ describe DeployToken do describe '#scopes' do context 'with all the scopes' do - it 'should return scopes assigned to DeployToken' do + it 'returns scopes assigned to DeployToken' do expect(deploy_token.scopes).to eq([:read_repository, :read_registry]) end end context 'with only one scope' do - it 'should return scopes assigned to DeployToken' do + it 'returns scopes assigned to DeployToken' do deploy_token = create(:deploy_token, read_registry: false) expect(deploy_token.scopes).to eq([:read_repository]) end @@ -50,7 +50,7 @@ describe DeployToken do end describe '#revoke!' do - it 'should update revoke attribute' do + it 'updates revoke attribute' do deploy_token.revoke! expect(deploy_token.revoked?).to be_truthy end @@ -58,20 +58,20 @@ describe DeployToken do describe "#active?" do context "when it has been revoked" do - it 'should return false' do + it 'returns false' do deploy_token.revoke! expect(deploy_token.active?).to be_falsy end end context "when it hasn't been revoked and is not expired" do - it 'should return true' do + it 'returns true' do expect(deploy_token.active?).to be_truthy end end context "when it hasn't been revoked and is expired" do - it 'should return true' do + it 'returns true' do deploy_token.update_attribute(:expires_at, Date.today - 5.days) expect(deploy_token.active?).to be_falsy end @@ -80,7 +80,7 @@ describe DeployToken do context "when it hasn't been revoked and has no expiry" do let(:deploy_token) { create(:deploy_token, expires_at: nil) } - it 'should return true' do + it 'returns true' do expect(deploy_token.active?).to be_truthy end end @@ -126,7 +126,7 @@ describe DeployToken do context 'when using Forever.date' do let(:deploy_token) { create(:deploy_token, expires_at: nil) } - it 'should return nil' do + it 'returns nil' do expect(deploy_token.expires_at).to be_nil end end @@ -135,7 +135,7 @@ describe DeployToken do let(:expires_at) { Date.today + 5.months } let(:deploy_token) { create(:deploy_token, expires_at: expires_at) } - it 'should return the personalized date' do + it 'returns the personalized date' do expect(deploy_token.expires_at).to eq(expires_at) end end @@ -145,7 +145,7 @@ describe DeployToken do context 'when passing nil' do let(:deploy_token) { create(:deploy_token, expires_at: nil) } - it 'should assign Forever.date' do + it 'assigns Forever.date' do expect(deploy_token.read_attribute(:expires_at)).to eq(Forever.date) end end @@ -154,7 +154,7 @@ describe DeployToken do let(:expires_at) { Date.today + 5.months } let(:deploy_token) { create(:deploy_token, expires_at: expires_at) } - it 'should respect the value' do + it 'respects the value' do expect(deploy_token.read_attribute(:expires_at)).to eq(expires_at) end end @@ -166,14 +166,14 @@ describe DeployToken do subject { project.deploy_tokens.gitlab_deploy_token } context 'with a gitlab deploy token associated' do - it 'should return the gitlab deploy token' do + it 'returns the gitlab deploy token' do deploy_token = create(:deploy_token, :gitlab_deploy_token, projects: [project]) is_expected.to eq(deploy_token) end end context 'with no gitlab deploy token associated' do - it 'should return nil' do + it 'returns nil' do is_expected.to be_nil end end diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index b2ffd5812ab..ad3e3061b9a 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -788,14 +788,14 @@ describe Group do describe '#has_parent?' do context 'when the group has a parent' do - it 'should be truthy' do + it 'is truthy' do group = create(:group, :nested) expect(group.has_parent?).to be_truthy end end context 'when the group has no parent' do - it 'should be falsy' do + it 'is falsy' do group = create(:group, parent: nil) expect(group.has_parent?).to be_falsy end diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 62e7dd3231b..387d1221c76 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -740,14 +740,14 @@ describe Namespace do describe '#full_path_was' do context 'when the group has no parent' do - it 'should return the path was' do + it 'returns the path was' do group = create(:group, parent: nil) expect(group.full_path_was).to eq(group.path_was) end end context 'when a parent is assigned to a group with no previous parent' do - it 'should return the path was' do + it 'returns the path was' do group = create(:group, parent: nil) parent = create(:group) @@ -758,7 +758,7 @@ describe Namespace do end context 'when a parent is removed from the group' do - it 'should return the parent full path' do + it 'returns the parent full path' do parent = create(:group) group = create(:group, parent: parent) group.parent = nil @@ -768,7 +768,7 @@ describe Namespace do end context 'when changing parents' do - it 'should return the previous parent full path' do + it 'returns the previous parent full path' do parent = create(:group) group = create(:group, parent: parent) new_parent = create(:group) diff --git a/spec/models/network/graph_spec.rb b/spec/models/network/graph_spec.rb index d1a2bedf542..232172fde76 100644 --- a/spec/models/network/graph_spec.rb +++ b/spec/models/network/graph_spec.rb @@ -22,7 +22,7 @@ describe Network::Graph do expect(commits).to all( be_kind_of(Network::Commit) ) end - it 'it the commits by commit date (descending)' do + it 'sorts commits by commit date (descending)' do # Remove duplicate timestamps because they make it harder to # assert that the commits are sorted as expected. commits = graph.commits.uniq(&:date) diff --git a/spec/models/project_auto_devops_spec.rb b/spec/models/project_auto_devops_spec.rb index 8ad28ce68cc..b81e5610e2c 100644 --- a/spec/models/project_auto_devops_spec.rb +++ b/spec/models/project_auto_devops_spec.rb @@ -117,7 +117,7 @@ describe ProjectAutoDevops do context 'when the project is public' do let(:project) { create(:project, :repository, :public) } - it 'should not create a gitlab deploy token' do + it 'does not create a gitlab deploy token' do expect do auto_devops.save end.not_to change { DeployToken.count } @@ -127,7 +127,7 @@ describe ProjectAutoDevops do context 'when the project is internal' do let(:project) { create(:project, :repository, :internal) } - it 'should create a gitlab deploy token' do + it 'creates a gitlab deploy token' do expect do auto_devops.save end.to change { DeployToken.count }.by(1) @@ -137,7 +137,7 @@ describe ProjectAutoDevops do context 'when the project is private' do let(:project) { create(:project, :repository, :private) } - it 'should create a gitlab deploy token' do + it 'creates a gitlab deploy token' do expect do auto_devops.save end.to change { DeployToken.count }.by(1) @@ -148,7 +148,7 @@ describe ProjectAutoDevops do let(:project) { create(:project, :repository, :internal) } let(:auto_devops) { build(:project_auto_devops, project: project) } - it 'should create a deploy token' do + it 'creates a deploy token' do expect do auto_devops.save end.to change { DeployToken.count }.by(1) @@ -159,7 +159,7 @@ describe ProjectAutoDevops do let(:project) { create(:project, :repository, :internal) } let(:auto_devops) { build(:project_auto_devops, enabled: nil, project: project) } - it 'should create a deploy token' do + it 'creates a deploy token' do allow(Gitlab::CurrentSettings).to receive(:auto_devops_enabled?).and_return(true) expect do @@ -172,7 +172,7 @@ describe ProjectAutoDevops do let(:project) { create(:project, :repository, :internal) } let(:auto_devops) { build(:project_auto_devops, :disabled, project: project) } - it 'should not create a deploy token' do + it 'does not create a deploy token' do expect do auto_devops.save end.not_to change { DeployToken.count } @@ -184,7 +184,7 @@ describe ProjectAutoDevops do let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, projects: [project]) } let(:auto_devops) { build(:project_auto_devops, project: project) } - it 'should not create a deploy token' do + it 'does not create a deploy token' do expect do auto_devops.save end.not_to change { DeployToken.count } @@ -196,7 +196,7 @@ describe ProjectAutoDevops do let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, :expired, projects: [project]) } let(:auto_devops) { build(:project_auto_devops, project: project) } - it 'should not create a deploy token' do + it 'does not create a deploy token' do expect do auto_devops.save end.not_to change { DeployToken.count } diff --git a/spec/models/project_services/kubernetes_service_spec.rb b/spec/models/project_services/kubernetes_service_spec.rb index 7bf093b71e7..3a381cb405d 100644 --- a/spec/models/project_services/kubernetes_service_spec.rb +++ b/spec/models/project_services/kubernetes_service_spec.rb @@ -70,11 +70,11 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do kubernetes_service.properties['namespace'] = "foo" end - it 'should not update attributes' do + it 'does not update attributes' do expect(kubernetes_service.save).to be_falsy end - it 'should include an error with a deprecation message' do + it 'includes an error with a deprecation message' do kubernetes_service.valid? expect(kubernetes_service.errors[:base].first).to match(/Kubernetes service integration has been deprecated/) end @@ -83,7 +83,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do context 'with a non-deprecated service' do let(:kubernetes_service) { create(:kubernetes_service) } - it 'should update attributes' do + it 'updates attributes' do kubernetes_service.properties['namespace'] = 'foo' expect(kubernetes_service.save).to be_truthy end @@ -98,15 +98,15 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do kubernetes_service.save end - it 'should deactive the service' do + it 'deactivates the service' do expect(kubernetes_service.active?).to be_falsy end - it 'should not include a deprecation message as error' do + it 'does not include a deprecation message as error' do expect(kubernetes_service.errors.messages.count).to eq(0) end - it 'should update attributes' do + it 'updates attributes' do expect(kubernetes_service.properties['namespace']).to eq("foo") end end @@ -118,7 +118,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do kubernetes_service.properties['namespace'] = 'foo' end - it 'should update attributes' do + it 'updates attributes' do expect(kubernetes_service.save).to be_truthy expect(kubernetes_service.properties['namespace']).to eq('foo') end @@ -392,13 +392,13 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do let(:kubernetes_service) { create(:kubernetes_service) } context 'with an active kubernetes service' do - it 'should return false' do + it 'returns false' do expect(kubernetes_service.deprecated?).to be_falsy end end context 'with a inactive kubernetes service' do - it 'should return true' do + it 'returns true' do kubernetes_service.update_attribute(:active, false) expect(kubernetes_service.deprecated?).to be_truthy end @@ -408,18 +408,18 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do describe "#deprecation_message" do let(:kubernetes_service) { create(:kubernetes_service) } - it 'should indicate the service is deprecated' do + it 'indicates the service is deprecated' do expect(kubernetes_service.deprecation_message).to match(/Kubernetes service integration has been deprecated/) end context 'if the services is active' do - it 'should return a message' do + it 'returns a message' do expect(kubernetes_service.deprecation_message).to match(/Your Kubernetes cluster information on this page is still editable/) end end context 'if the service is not active' do - it 'should return a message' do + it 'returns a message' do kubernetes_service.update_attribute(:active, false) expect(kubernetes_service.deprecation_message).to match(/Fields on this page are now uneditable/) end diff --git a/spec/models/project_services/pivotaltracker_service_spec.rb b/spec/models/project_services/pivotaltracker_service_spec.rb index de2c8790405..773b8b7890f 100644 --- a/spec/models/project_services/pivotaltracker_service_spec.rb +++ b/spec/models/project_services/pivotaltracker_service_spec.rb @@ -56,7 +56,7 @@ describe PivotaltrackerService do WebMock.stub_request(:post, url) end - it 'should post correct message' do + it 'posts correct message' do service.execute(push_data) expect(WebMock).to have_requested(:post, url).with( body: { @@ -81,14 +81,14 @@ describe PivotaltrackerService do end end - it 'should post message if branch is in the list' do + it 'posts message if branch is in the list' do service.execute(push_data(branch: 'master')) service.execute(push_data(branch: 'v10')) expect(WebMock).to have_requested(:post, url).twice end - it 'should not post message if branch is not in the list' do + it 'does not post message if branch is not in the list' do service.execute(push_data(branch: 'mas')) service.execute(push_data(branch: 'v11')) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 33e514cd7b9..5eb31430ccd 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -415,7 +415,7 @@ describe Project do project.project_feature.update_attribute(:builds_access_level, ProjectFeature::DISABLED) end - it 'should return .external pipelines' do + it 'returns .external pipelines' do expect(project.all_pipelines).to all(have_attributes(source: 'external')) expect(project.all_pipelines.size).to eq(1) end @@ -439,7 +439,7 @@ describe Project do project.project_feature.update_attribute(:builds_access_level, ProjectFeature::DISABLED) end - it 'should return .external pipelines' do + it 'returns .external pipelines' do expect(project.ci_pipelines).to all(have_attributes(source: 'external')) expect(project.ci_pipelines.size).to eq(1) end @@ -1910,7 +1910,7 @@ describe Project do tags: %w[latest rc1]) end - it 'should have image tags' do + it 'has image tags' do expect(project).to have_container_registry_tags end end @@ -1921,7 +1921,7 @@ describe Project do tags: %w[latest rc1 pre1]) end - it 'should have image tags' do + it 'has image tags' do expect(project).to have_container_registry_tags end end @@ -1931,7 +1931,7 @@ describe Project do stub_container_registry_tags(repository: :any, tags: []) end - it 'should not have image tags' do + it 'does not have image tags' do expect(project).not_to have_container_registry_tags end end @@ -1942,16 +1942,16 @@ describe Project do stub_container_registry_config(enabled: false) end - it 'should not have image tags' do + it 'does not have image tags' do expect(project).not_to have_container_registry_tags end - it 'should not check root repository tags' do + it 'does not check root repository tags' do expect(project).not_to receive(:full_path) expect(project).not_to have_container_registry_tags end - it 'should iterate through container repositories' do + it 'iterates through container repositories' do expect(project).to receive(:container_repositories) expect(project).not_to have_container_registry_tags end @@ -2638,7 +2638,7 @@ describe Project do let!(:cluster) { kubernetes_namespace.cluster } let(:project) { kubernetes_namespace.project } - it 'should return token from kubernetes namespace' do + it 'returns token from kubernetes namespace' do expect(project.deployment_variables).to include( { key: 'KUBE_TOKEN', value: kubernetes_namespace.service_account_token, public: false, masked: true } ) diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb index 0478094034a..f743dfed31f 100644 --- a/spec/models/remote_mirror_spec.rb +++ b/spec/models/remote_mirror_spec.rb @@ -7,14 +7,14 @@ describe RemoteMirror, :mailer do describe 'URL validation' do context 'with a valid URL' do - it 'should be valid' do + it 'is valid' do remote_mirror = build(:remote_mirror) expect(remote_mirror).to be_valid end end context 'with an invalid URL' do - it 'should not be valid' do + it 'is not valid' do remote_mirror = build(:remote_mirror, url: 'ftp://invalid.invalid') expect(remote_mirror).not_to be_valid diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 2578208659a..3f5d285bc2c 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -50,7 +50,7 @@ describe Repository do it { is_expected.not_to include('fix') } describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error do broken_repository.branch_names_contains(sample_commit.id) end @@ -225,7 +225,7 @@ describe Repository do it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') } describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error do broken_repository.last_commit_id_for_path(sample_commit.id, '.gitignore') end @@ -249,7 +249,7 @@ describe Repository do end describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error do broken_repository.last_commit_for_path(sample_commit.id, '.gitignore').id end @@ -390,7 +390,7 @@ describe Repository do end describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error { broken_repository.find_commits_by_message('s') } end end @@ -726,7 +726,7 @@ describe Repository do end describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error do broken_repository.search_files_by_content('feature', 'master') end @@ -775,7 +775,7 @@ describe Repository do end describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error { broken_repository.search_files_by_name('files', 'master') } end end @@ -817,7 +817,7 @@ describe Repository do let(:broken_repository) { create(:project, :broken_storage).repository } describe 'when storage is broken', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error do broken_repository.fetch_ref(broken_repository, source_ref: '1', target_ref: '2') end @@ -1018,7 +1018,7 @@ describe Repository do repository.add_branch(project.creator, ref, 'master') end - it 'should be true' do + it 'is true' do is_expected.to eq(true) end end @@ -1028,7 +1028,7 @@ describe Repository do repository.add_tag(project.creator, ref, 'master') end - it 'should be false' do + it 'is false' do is_expected.to eq(false) end end @@ -1152,7 +1152,7 @@ describe Repository do end context 'with broken storage', :broken_storage do - it 'should raise a storage error' do + it 'raises a storage error' do expect_to_raise_storage_error { broken_repository.exists? } end end @@ -2249,11 +2249,11 @@ describe Repository do let(:commit) { repository.commit } let(:ancestor) { commit.parents.first } - it 'it is an ancestor' do + it 'is an ancestor' do expect(repository.ancestor?(ancestor.id, commit.id)).to eq(true) end - it 'it is not an ancestor' do + it 'is not an ancestor' do expect(repository.ancestor?(commit.id, ancestor.id)).to eq(false) end diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 2f025038bab..64db32781fe 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -291,7 +291,7 @@ describe Service do describe "#deprecated?" do let(:project) { create(:project, :repository) } - it 'should return false by default' do + it 'returns false by default' do service = create(:service, project: project) expect(service.deprecated?).to be_falsy end @@ -300,7 +300,7 @@ describe Service do describe "#deprecation_message" do let(:project) { create(:project, :repository) } - it 'should be empty by default' do + it 'is empty by default' do service = create(:service, project: project) expect(service.deprecation_message).to be_nil end |