diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-21 17:29:35 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 09:31:56 -0600 |
commit | 3dadf306ddc81183e74b048bc4119796852ed7ea (patch) | |
tree | f01d5e7eb9c5550bc34a42d9e88479cd3fef578d /spec | |
parent | 547063b3ac096dff25309b6e0846b0d5f417c128 (diff) | |
download | gitlab-ce-3dadf306ddc81183e74b048bc4119796852ed7ea.tar.gz |
Enable Style/DotPosition
Diffstat (limited to 'spec')
110 files changed, 558 insertions, 558 deletions
diff --git a/spec/controllers/ci/projects_controller_spec.rb b/spec/controllers/ci/projects_controller_spec.rb index 86f01f437a2..3cd955dc9d4 100644 --- a/spec/controllers/ci/projects_controller_spec.rb +++ b/spec/controllers/ci/projects_controller_spec.rb @@ -33,8 +33,8 @@ describe Ci::ProjectsController do shared_examples 'badge provider' do it 'shows badge' do expect(response.status).to eq 200 - expect(response.headers) - .to include('Content-Type' => 'image/svg+xml') + expect(response.headers). + to include('Content-Type' => 'image/svg+xml') end end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index f84f922ba5e..1c5dbda0de2 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -334,9 +334,9 @@ describe Projects::MergeRequestsController do it 'sets the MR to merge when the build succeeds' do service = double(:merge_when_build_succeeds_service) - expect(MergeRequests::MergeWhenPipelineSucceedsService) - .to receive(:new).with(project, anything, anything) - .and_return(service) + expect(MergeRequests::MergeWhenPipelineSucceedsService). + to receive(:new).with(project, anything, anything). + and_return(service) expect(service).to receive(:execute).with(merge_request) merge_when_build_succeeds diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index b56c7880b64..d951325f765 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -11,8 +11,8 @@ describe SessionsController do it 'does not authenticate user' do post(:create, user: { login: 'invalid', password: 'invalid' }) - expect(response) - .to set_flash.now[:alert].to /Invalid Login or password/ + expect(response). + to set_flash.now[:alert].to /Invalid Login or password/ end end @@ -102,8 +102,8 @@ describe SessionsController do end it 'warns about invalid OTP code' do - expect(response).to set_flash.now[:alert] - .to /Invalid two-factor code/ + expect(response).to set_flash.now[:alert]. + to /Invalid two-factor code/ end end end @@ -129,8 +129,8 @@ describe SessionsController do end it 'warns about invalid login' do - expect(response).to set_flash.now[:alert] - .to /Invalid Login or password/ + expect(response).to set_flash.now[:alert]. + to /Invalid Login or password/ end it 'locks the user' do @@ -140,8 +140,8 @@ describe SessionsController do it 'keeps the user locked on future login attempts' do post(:create, user: { login: user.username, password: user.password }) - expect(response) - .to set_flash.now[:alert].to /Invalid Login or password/ + expect(response). + to set_flash.now[:alert].to /Invalid Login or password/ end end end @@ -153,8 +153,8 @@ describe SessionsController do authenticate_2fa(login: another_user.username, otp_attempt: 'invalid') - expect(response).to set_flash.now[:alert] - .to /Invalid two-factor code/ + expect(response).to set_flash.now[:alert]. + to /Invalid two-factor code/ end end end diff --git a/spec/features/environments_spec.rb b/spec/features/environments_spec.rb index 78be7d36f47..513de297fdf 100644 --- a/spec/features/environments_spec.rb +++ b/spec/features/environments_spec.rb @@ -111,8 +111,8 @@ feature 'Environments page', :feature, :js do find('.js-dropdown-play-icon-container').click expect(page).to have_content(manual.name.humanize) - expect { click_link(manual.name.humanize) } - .not_to change { Ci::Pipeline.count } + expect { click_link(manual.name.humanize) }. + not_to change { Ci::Pipeline.count } expect(manual.reload).to be_pending end diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb index 73c5ef31edc..9fc5339308c 100644 --- a/spec/features/merge_requests/created_from_fork_spec.rb +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -61,8 +61,8 @@ feature 'Merge request created from fork' do expect(page).to have_content pipeline.id end - expect(page.find('a.btn-remove')[:href]) - .to include fork_project.path_with_namespace + expect(page.find('a.btn-remove')[:href]). + to include fork_project.path_with_namespace end end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 592dc4483d2..81f5ebf6339 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -366,8 +366,8 @@ describe 'Pipelines', :feature, :js do before { stub_ci_pipeline_to_return_yaml_file } it 'creates a new pipeline' do - expect { click_on 'Create pipeline' } - .to change { Ci::Pipeline.count }.by(1) + expect { click_on 'Create pipeline' }. + to change { Ci::Pipeline.count }.by(1) end end diff --git a/spec/finders/environments_finder_spec.rb b/spec/finders/environments_finder_spec.rb index 0c063f6d5ee..ed60a95deba 100644 --- a/spec/finders/environments_finder_spec.rb +++ b/spec/finders/environments_finder_spec.rb @@ -16,18 +16,18 @@ describe EnvironmentsFinder do end it 'returns environment when with_tags is set' do - expect(described_class.new(project, user, ref: 'master', commit: project.commit, with_tags: true).execute) - .to contain_exactly(environment) + expect(described_class.new(project, user, ref: 'master', commit: project.commit, with_tags: true).execute). + to contain_exactly(environment) end it 'does not return environment when no with_tags is set' do - expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute) - .to be_empty + expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute). + to be_empty end it 'does not return environment when commit is not part of deployment' do - expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute) - .to be_empty + expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute). + to be_empty end end @@ -37,23 +37,23 @@ describe EnvironmentsFinder do end it 'returns environment when ref is set' do - expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute) - .to contain_exactly(environment) + expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute). + to contain_exactly(environment) end it 'does not environment when ref is different' do - expect(described_class.new(project, user, ref: 'feature', commit: project.commit).execute) - .to be_empty + expect(described_class.new(project, user, ref: 'feature', commit: project.commit).execute). + to be_empty end it 'does not return environment when commit is not part of deployment' do - expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute) - .to be_empty + expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute). + to be_empty end it 'returns environment when commit constraint is not set' do - expect(described_class.new(project, user, ref: 'master').execute) - .to contain_exactly(environment) + expect(described_class.new(project, user, ref: 'master').execute). + to contain_exactly(environment) end end @@ -63,8 +63,8 @@ describe EnvironmentsFinder do end it 'returns environment' do - expect(described_class.new(project, user, commit: project.commit).execute) - .to contain_exactly(environment) + expect(described_class.new(project, user, commit: project.commit).execute). + to contain_exactly(environment) end end @@ -75,8 +75,8 @@ describe EnvironmentsFinder do end it 'finds recently updated environment' do - expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute) - .to contain_exactly(environment) + expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute). + to contain_exactly(environment) end end @@ -87,8 +87,8 @@ describe EnvironmentsFinder do end it 'does not find environment' do - expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute) - .to be_empty + expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute). + to be_empty end end @@ -101,8 +101,8 @@ describe EnvironmentsFinder do end it 'finds both environments' do - expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute) - .to contain_exactly(environment, second_environment) + expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute). + to contain_exactly(environment, second_environment) end end end diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 13fb9c1f1a7..e1e56582425 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -67,8 +67,8 @@ describe IssuesHelper do user = build_stubbed(:user, name: 'Joe') awards = Array.new(3, build_stubbed(:award_emoji, user: user)) - expect(award_user_list(awards, nil, limit: 3)) - .to eq('Joe, Joe, and Joe') + expect(award_user_list(awards, nil, limit: 3)). + to eq('Joe, Joe, and Joe') end it "displays the current user's name as 'You'" do @@ -83,8 +83,8 @@ describe IssuesHelper do user = build_stubbed(:user, name: 'Jane') awards = Array.new(5, build_stubbed(:award_emoji, user: user)) - expect(award_user_list(awards, nil, limit: 3)) - .to eq('Jane, Jane, Jane, and 2 more.') + expect(award_user_list(awards, nil, limit: 3)). + to eq('Jane, Jane, Jane, and 2 more.') end it "displays the current user in front of other users" do diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb index 2cc0b40b2d0..9d7a39d3721 100644 --- a/spec/helpers/page_layout_helper_spec.rb +++ b/spec/helpers/page_layout_helper_spec.rb @@ -111,8 +111,8 @@ describe PageLayoutHelper do end it 'escapes content' do - allow(helper).to receive(:page_card_attributes) - .and_return(foo: %q{foo" http-equiv="refresh}.html_safe) + allow(helper).to receive(:page_card_attributes). + and_return(foo: %q{foo" http-equiv="refresh}.html_safe) tags = helper.page_card_meta_tags diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb index 8942b00b128..387279b2031 100644 --- a/spec/helpers/visibility_level_helper_spec.rb +++ b/spec/helpers/visibility_level_helper_spec.rb @@ -9,52 +9,52 @@ describe VisibilityLevelHelper do describe 'visibility_level_description' do context 'used with a Project' do it 'delegates projects to #project_visibility_level_description' do - expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project)) - .to match /project/i + expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project)). + to match /project/i end end context 'used with a Group' do it 'delegates groups to #group_visibility_level_description' do - expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, group)) - .to match /group/i + expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, group)). + to match /group/i end end context 'called with a Snippet' do it 'delegates snippets to #snippet_visibility_level_description' do - expect(visibility_level_description(Gitlab::VisibilityLevel::INTERNAL, project_snippet)) - .to match /snippet/i + expect(visibility_level_description(Gitlab::VisibilityLevel::INTERNAL, project_snippet)). + to match /snippet/i end end end describe "#project_visibility_level_description" do it "describes private projects" do - expect(project_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)) - .to eq "Project access must be granted explicitly to each user." + expect(project_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)). + to eq "Project access must be granted explicitly to each user." end it "describes public projects" do - expect(project_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC)) - .to eq "The project can be cloned without any authentication." + expect(project_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC)). + to eq "The project can be cloned without any authentication." end end describe "#snippet_visibility_level_description" do it 'describes visibility only for me' do - expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, personal_snippet)) - .to eq "The snippet is visible only to me." + expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, personal_snippet)). + to eq "The snippet is visible only to me." end it 'describes visibility for project members' do - expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project_snippet)) - .to eq "The snippet is visible only to project members." + expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project_snippet)). + to eq "The snippet is visible only to project members." end it 'defaults to personal snippet' do - expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)) - .to eq "The snippet is visible only to me." + expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)). + to eq "The snippet is visible only to me." end end diff --git a/spec/lib/api/helpers/pagination_spec.rb b/spec/lib/api/helpers/pagination_spec.rb index 267318faed4..152c36a3ae6 100644 --- a/spec/lib/api/helpers/pagination_spec.rb +++ b/spec/lib/api/helpers/pagination_spec.rb @@ -37,8 +37,8 @@ describe API::Helpers::Pagination do describe 'first page' do before do - allow(subject).to receive(:params) - .and_return({ page: 1, per_page: 2 }) + allow(subject).to receive(:params). + and_return({ page: 1, per_page: 2 }) end it 'returns appropriate amount of resources' do @@ -60,8 +60,8 @@ describe API::Helpers::Pagination do describe 'second page' do before do - allow(subject).to receive(:params) - .and_return({ page: 2, per_page: 2 }) + allow(subject).to receive(:params). + and_return({ page: 2, per_page: 2 }) end it 'returns appropriate amount of resources' do @@ -87,8 +87,8 @@ describe API::Helpers::Pagination do end def expect_message(method) - expect(subject).to receive(method) - .at_least(:once).and_return(value) + expect(subject).to receive(method). + at_least(:once).and_return(value) end end end diff --git a/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb index fbf7a461fa5..efd145e9452 100644 --- a/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb @@ -33,8 +33,8 @@ describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do doc = filter("Issue #{reference}") issue_id = doc.css('a').first.attr("data-external-issue") - expect(doc.css('a').first.attr('href')) - .to eq helper.url_for_issue(issue_id, project) + expect(doc.css('a').first.attr('href')). + to eq helper.url_for_issue(issue_id, project) end it 'links to the external tracker' do diff --git a/spec/lib/banzai/filter/label_reference_filter_spec.rb b/spec/lib/banzai/filter/label_reference_filter_spec.rb index 284641fb20a..5e16fd10ebe 100644 --- a/spec/lib/banzai/filter/label_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/label_reference_filter_spec.rb @@ -372,8 +372,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do let!(:result) { reference_filter("See #{reference}") } it 'links to a valid reference' do - expect(result.css('a').first.attr('href')) - .to eq urls.namespace_project_issues_url(project2.namespace, + expect(result.css('a').first.attr('href')). + to eq urls.namespace_project_issues_url(project2.namespace, project2, label_name: label.name) end @@ -406,8 +406,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do let!(:result) { reference_filter("See #{reference}") } it 'links to a valid reference' do - expect(result.css('a').first.attr('href')) - .to eq urls.namespace_project_issues_url(project2.namespace, + expect(result.css('a').first.attr('href')). + to eq urls.namespace_project_issues_url(project2.namespace, project2, label_name: label.name) end @@ -440,8 +440,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do let!(:result) { reference_filter("See #{reference}") } it 'links to a valid reference' do - expect(result.css('a').first.attr('href')) - .to eq urls.namespace_project_issues_url(project2.namespace, + expect(result.css('a').first.attr('href')). + to eq urls.namespace_project_issues_url(project2.namespace, project2, label_name: label.name) end @@ -476,8 +476,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do let!(:result) { reference_filter("See #{reference}", project: project) } it 'points to referenced project issues page' do - expect(result.css('a').first.attr('href')) - .to eq urls.namespace_project_issues_url(another_project.namespace, + expect(result.css('a').first.attr('href')). + to eq urls.namespace_project_issues_url(another_project.namespace, another_project, label_name: group_label.name) end @@ -549,15 +549,15 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do let!(:result) { reference_filter("See #{reference}", project: project) } it 'points to referenced project issues page' do - expect(result.css('a').first.attr('href')) - .to eq urls.namespace_project_issues_url(project.namespace, + expect(result.css('a').first.attr('href')). + to eq urls.namespace_project_issues_url(project.namespace, project, label_name: group_label.name) end it 'has valid color' do - expect(result.css('a span').first.attr('style')) - .to match /background-color: #00ff00/ + expect(result.css('a span').first.attr('style')). + to match /background-color: #00ff00/ end it 'has valid link text' do @@ -583,8 +583,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do let!(:result) { reference_filter("See #{reference}", project: project) } it 'points to referenced project issues page' do - expect(result.css('a').first.attr('href')) - .to eq urls.namespace_project_issues_url(project.namespace, + expect(result.css('a').first.attr('href')). + to eq urls.namespace_project_issues_url(project.namespace, project, label_name: group_label.name) end diff --git a/spec/lib/banzai/filter/user_reference_filter_spec.rb b/spec/lib/banzai/filter/user_reference_filter_spec.rb index d5d128c1907..e9b7b566806 100644 --- a/spec/lib/banzai/filter/user_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/user_reference_filter_spec.rb @@ -37,8 +37,8 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do doc = reference_filter("Hey #{reference}", author: user) expect(doc.css('a').length).to eq 1 - expect(doc.css('a').first.attr('href')) - .to eq urls.namespace_project_url(project.namespace, project) + expect(doc.css('a').first.attr('href')). + to eq urls.namespace_project_url(project.namespace, project) end it 'includes a data-author attribute when there is an author' do diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index 68ad429608d..ce31f8a8432 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -25,8 +25,8 @@ module Ci end it 'includes coverage regexp in build attributes' do - expect(subject) - .to include(coverage_regex: 'Code coverage: \d+\.\d+') + expect(subject). + to include(coverage_regex: 'Code coverage: \d+\.\d+') end end end @@ -584,8 +584,8 @@ module Ci end it 'raises error' do - expect { subject } - .to raise_error(GitlabCiYamlProcessor::ValidationError, + expect { subject }. + to raise_error(GitlabCiYamlProcessor::ValidationError, /jobs:rspec:variables config should be a hash of key value pairs/) end end @@ -1365,8 +1365,8 @@ EOT it "returns an error about invalid configutaion" do content = YAML.dump("invalid: yaml: test") - expect(GitlabCiYamlProcessor.validation_message(content)) - .to eq "Invalid configuration format" + expect(GitlabCiYamlProcessor.validation_message(content)). + to eq "Invalid configuration format" end end @@ -1374,15 +1374,15 @@ EOT it "returns an error about invalid tags" do content = YAML.dump({ rspec: { script: "test", tags: "mysql" } }) - expect(GitlabCiYamlProcessor.validation_message(content)) - .to eq "jobs:rspec tags should be an array of strings" + expect(GitlabCiYamlProcessor.validation_message(content)). + to eq "jobs:rspec tags should be an array of strings" end end context "when YAML content is empty" do it "returns an error about missing content" do - expect(GitlabCiYamlProcessor.validation_message('')) - .to eq "Please provide content of .gitlab-ci.yml" + expect(GitlabCiYamlProcessor.validation_message('')). + to eq "Please provide content of .gitlab-ci.yml" end end diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index bca57105d1d..e193a3b79a6 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -19,8 +19,8 @@ module Gitlab attributes: described_class::DEFAULT_ADOC_ATTRS } - expect(Asciidoctor).to receive(:convert) - .with(input, expected_asciidoc_opts).and_return(html) + expect(Asciidoctor).to receive(:convert). + with(input, expected_asciidoc_opts).and_return(html) expect( render(input, context) ).to eql html end @@ -35,8 +35,8 @@ module Gitlab attributes: described_class::DEFAULT_ADOC_ATTRS + ['foo'] } - expect(Asciidoctor).to receive(:convert) - .with(input, expected_asciidoc_opts).and_return(html) + expect(Asciidoctor).to receive(:convert). + with(input, expected_asciidoc_opts).and_return(html) render(input, context, asciidoc_opts) end diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb index b234de4c772..57c416fb35a 100644 --- a/spec/lib/gitlab/auth_spec.rb +++ b/spec/lib/gitlab/auth_spec.rb @@ -140,8 +140,8 @@ describe Gitlab::Auth, lib: true do password: 'my-secret', ) - expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')) - .to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) + expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')). + to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) end it 'falls through oauth authentication when the username is oauth2' do @@ -151,8 +151,8 @@ describe Gitlab::Auth, lib: true do password: 'my-secret', ) - expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')) - .to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) + expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')). + to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) end end diff --git a/spec/lib/gitlab/backup/manager_spec.rb b/spec/lib/gitlab/backup/manager_spec.rb index f84782ab440..e9c69183d00 100644 --- a/spec/lib/gitlab/backup/manager_spec.rb +++ b/spec/lib/gitlab/backup/manager_spec.rb @@ -141,8 +141,8 @@ describe Backup::Manager, lib: true do it 'fails the operation and prints an error' do expect { subject.unpack }.to raise_error SystemExit - expect(progress).to have_received(:puts) - .with(a_string_matching('No backups found')) + expect(progress).to have_received(:puts). + with(a_string_matching('No backups found')) end end @@ -158,8 +158,8 @@ describe Backup::Manager, lib: true do it 'fails the operation and prints an error' do expect { subject.unpack }.to raise_error SystemExit - expect(progress).to have_received(:puts) - .with(a_string_matching('Found more than one backup')) + expect(progress).to have_received(:puts). + with(a_string_matching('Found more than one backup')) end end @@ -178,8 +178,8 @@ describe Backup::Manager, lib: true do it 'fails the operation and prints an error' do expect { subject.unpack }.to raise_error SystemExit expect(File).to have_received(:exist?).with('wrong_gitlab_backup.tar') - expect(progress).to have_received(:puts) - .with(a_string_matching('The backup file wrong_gitlab_backup.tar does not exist')) + expect(progress).to have_received(:puts). + with(a_string_matching('The backup file wrong_gitlab_backup.tar does not exist')) end end @@ -200,8 +200,8 @@ describe Backup::Manager, lib: true do it 'unpacks the file' do subject.unpack - expect(Kernel).to have_received(:system) - .with("tar", "-xf", "1451606400_2016_01_01_gitlab_backup.tar") + expect(Kernel).to have_received(:system). + with("tar", "-xf", "1451606400_2016_01_01_gitlab_backup.tar") expect(progress).to have_received(:puts).with(a_string_matching('done')) end end diff --git a/spec/lib/gitlab/badge/build/status_spec.rb b/spec/lib/gitlab/badge/build/status_spec.rb index 3c5414701a7..8a4bf4dc89b 100644 --- a/spec/lib/gitlab/badge/build/status_spec.rb +++ b/spec/lib/gitlab/badge/build/status_spec.rb @@ -20,8 +20,8 @@ describe Gitlab::Badge::Build::Status do describe '#metadata' do it 'returns badge metadata' do - expect(badge.metadata.image_url) - .to include 'badges/master/build.svg' + expect(badge.metadata.image_url). + to include 'badges/master/build.svg' end end diff --git a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb index 5c31423fdee..987a0b1f67f 100644 --- a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb @@ -26,8 +26,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do let(:config) { { name: 10 } } it 'reports error' do - expect(entry.errors) - .to include 'artifacts name should be a string' + expect(entry.errors). + to include 'artifacts name should be a string' end end @@ -35,8 +35,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do let(:config) { { test: 100 } } it 'reports error' do - expect(entry.errors) - .to include 'artifacts config contains unknown keys: test' + expect(entry.errors). + to include 'artifacts config contains unknown keys: test' end end end diff --git a/spec/lib/gitlab/ci/config/entry/attributable_spec.rb b/spec/lib/gitlab/ci/config/entry/attributable_spec.rb index fde03c51e2c..efb8c5adab1 100644 --- a/spec/lib/gitlab/ci/config/entry/attributable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/attributable_spec.rb @@ -14,9 +14,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do context 'config is a hash' do before do - allow(instance) - .to receive(:config) - .and_return({ name: 'some name', test: 'some test' }) + allow(instance). + to receive(:config). + and_return({ name: 'some name', test: 'some test' }) end it 'returns the value of config' do @@ -31,9 +31,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do context 'config is not a hash' do before do - allow(instance) - .to receive(:config) - .and_return('some test') + allow(instance). + to receive(:config). + and_return('some test') end it 'returns nil' do diff --git a/spec/lib/gitlab/ci/config/entry/boolean_spec.rb b/spec/lib/gitlab/ci/config/entry/boolean_spec.rb index 5f067cad93c..8987c0549c5 100644 --- a/spec/lib/gitlab/ci/config/entry/boolean_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/boolean_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Boolean do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'boolean config should be a boolean value' + expect(entry.errors). + to include 'boolean config should be a boolean value' end end end diff --git a/spec/lib/gitlab/ci/config/entry/cache_spec.rb b/spec/lib/gitlab/ci/config/entry/cache_spec.rb index 70a327c5183..e91f049ee72 100644 --- a/spec/lib/gitlab/ci/config/entry/cache_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/cache_spec.rb @@ -32,8 +32,8 @@ describe Gitlab::Ci::Config::Entry::Cache do let(:config) { 'ls' } it 'reports errors with config value' do - expect(entry.errors) - .to include 'cache config should be a hash' + expect(entry.errors). + to include 'cache config should be a hash' end end @@ -41,8 +41,8 @@ describe Gitlab::Ci::Config::Entry::Cache do let(:config) { { key: 1 } } it 'reports error with descendants' do - expect(entry.errors) - .to include 'key config should be a string or symbol' + expect(entry.errors). + to include 'key config should be a string or symbol' end end @@ -50,8 +50,8 @@ describe Gitlab::Ci::Config::Entry::Cache do let(:config) { { invalid: true } } it 'reports error with descendants' do - expect(entry.errors) - .to include 'cache config contains unknown keys: invalid' + expect(entry.errors). + to include 'cache config contains unknown keys: invalid' end end end diff --git a/spec/lib/gitlab/ci/config/entry/commands_spec.rb b/spec/lib/gitlab/ci/config/entry/commands_spec.rb index b8b0825a1c7..fa3dbd9bf32 100644 --- a/spec/lib/gitlab/ci/config/entry/commands_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/commands_spec.rb @@ -40,8 +40,8 @@ describe Gitlab::Ci::Config::Entry::Commands do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'commands config should be a ' \ + expect(entry.errors). + to include 'commands config should be a ' \ 'string or an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/configurable_spec.rb b/spec/lib/gitlab/ci/config/entry/configurable_spec.rb index ae7e628b5b5..490ba9b7df1 100644 --- a/spec/lib/gitlab/ci/config/entry/configurable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/configurable_spec.rb @@ -52,8 +52,8 @@ describe Gitlab::Ci::Config::Entry::Configurable do end it 'creates a node factory' do - expect(entry.nodes[:object]) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Factory + expect(entry.nodes[:object]). + to be_an_instance_of Gitlab::Ci::Config::Entry::Factory end it 'returns a duplicated factory object' do diff --git a/spec/lib/gitlab/ci/config/entry/environment_spec.rb b/spec/lib/gitlab/ci/config/entry/environment_spec.rb index 2adbed2154f..fab2825fbb0 100644 --- a/spec/lib/gitlab/ci/config/entry/environment_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/environment_spec.rb @@ -112,8 +112,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid action' do - expect(entry.errors) - .to include 'environment action should be start or stop' + expect(entry.errors). + to include 'environment action should be start or stop' end end end @@ -143,8 +143,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid action' do - expect(entry.errors) - .to include 'environment on stop should be a string' + expect(entry.errors). + to include 'environment on stop should be a string' end end end @@ -174,8 +174,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid type' do - expect(entry.errors) - .to include 'environment config should be a hash or a string' + expect(entry.errors). + to include 'environment config should be a hash or a string' end end end @@ -191,8 +191,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors?' do it 'contains error about missing environment name' do - expect(entry.errors) - .to include "environment name can't be blank" + expect(entry.errors). + to include "environment name can't be blank" end end end diff --git a/spec/lib/gitlab/ci/config/entry/factory_spec.rb b/spec/lib/gitlab/ci/config/entry/factory_spec.rb index 00dad5d9591..281a110071a 100644 --- a/spec/lib/gitlab/ci/config/entry/factory_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/factory_spec.rb @@ -7,19 +7,19 @@ describe Gitlab::Ci::Config::Entry::Factory do context 'when setting a concrete value' do it 'creates entry with valid value' do - entry = factory - .value(['ls', 'pwd']) - .create! + entry = factory. + value(['ls', 'pwd']). + create! expect(entry.value).to eq ['ls', 'pwd'] end context 'when setting description' do it 'creates entry with description' do - entry = factory - .value(['ls', 'pwd']) - .with(description: 'test description') - .create! + entry = factory. + value(['ls', 'pwd']). + with(description: 'test description'). + create! expect(entry.value).to eq ['ls', 'pwd'] expect(entry.description).to eq 'test description' @@ -28,10 +28,10 @@ describe Gitlab::Ci::Config::Entry::Factory do context 'when setting key' do it 'creates entry with custom key' do - entry = factory - .value(['ls', 'pwd']) - .with(key: 'test key') - .create! + entry = factory. + value(['ls', 'pwd']). + with(key: 'test key'). + create! expect(entry.key).to eq 'test key' end @@ -41,10 +41,10 @@ describe Gitlab::Ci::Config::Entry::Factory do let(:object) { Object.new } it 'creates entry with valid parent' do - entry = factory - .value('ls') - .with(parent: object) - .create! + entry = factory. + value('ls'). + with(parent: object). + create! expect(entry.parent).to eq object end @@ -61,12 +61,12 @@ describe Gitlab::Ci::Config::Entry::Factory do context 'when creating entry with nil value' do it 'creates an undefined entry' do - entry = factory - .value(nil) - .create! + entry = factory. + value(nil). + create! - expect(entry) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified + expect(entry). + to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified end end @@ -74,13 +74,13 @@ describe Gitlab::Ci::Config::Entry::Factory do let(:entry) { spy('entry') } it 'passes metadata as a parameter' do - factory - .value('some value') - .metadata(some: 'hash') - .create! + factory. + value('some value'). + metadata(some: 'hash'). + create! - expect(entry).to have_received(:new) - .with('some value', { some: 'hash' }) + expect(entry).to have_received(:new). + with('some value', { some: 'hash' }) end end end diff --git a/spec/lib/gitlab/ci/config/entry/global_spec.rb b/spec/lib/gitlab/ci/config/entry/global_spec.rb index 432a99dce33..c3551a149ed 100644 --- a/spec/lib/gitlab/ci/config/entry/global_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/global_spec.rb @@ -10,8 +10,8 @@ describe Gitlab::Ci::Config::Entry::Global do context 'when filtering all the entry/node names' do it 'contains the expected node names' do - expect(described_class.nodes.keys) - .to match_array(%i[before_script image services + expect(described_class.nodes.keys). + to match_array(%i[before_script image services after_script variables stages types cache]) end @@ -44,17 +44,17 @@ describe Gitlab::Ci::Config::Entry::Global do end it 'creates node object using valid class' do - expect(global.descendants.first) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Script - expect(global.descendants.second) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Image + expect(global.descendants.first). + to be_an_instance_of Gitlab::Ci::Config::Entry::Script + expect(global.descendants.second). + to be_an_instance_of Gitlab::Ci::Config::Entry::Image end it 'sets correct description for nodes' do - expect(global.descendants.first.description) - .to eq 'Script that will be executed before each job.' - expect(global.descendants.second.description) - .to eq 'Docker image that will be used to execute jobs.' + expect(global.descendants.first.description). + to eq 'Script that will be executed before each job.' + expect(global.descendants.second.description). + to eq 'Docker image that will be used to execute jobs.' end describe '#leaf?' do @@ -138,8 +138,8 @@ describe Gitlab::Ci::Config::Entry::Global do describe '#cache_value' do it 'returns cache configuration' do - expect(global.cache_value) - .to eq(key: 'k', untracked: true, paths: ['public/']) + expect(global.cache_value). + to eq(key: 'k', untracked: true, paths: ['public/']) end end @@ -185,8 +185,8 @@ describe Gitlab::Ci::Config::Entry::Global do end it 'contains unspecified nodes' do - expect(global.descendants.first) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified + expect(global.descendants.first). + to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified end end @@ -246,8 +246,8 @@ describe Gitlab::Ci::Config::Entry::Global do describe '#errors' do it 'reports errors from child nodes' do - expect(global.errors) - .to include 'before_script config should be an array of strings' + expect(global.errors). + to include 'before_script config should be an array of strings' end end @@ -265,8 +265,8 @@ describe Gitlab::Ci::Config::Entry::Global do describe '#errors' do it 'reports errors about missing script' do - expect(global.errors) - .to include "jobs:rspec script can't be blank" + expect(global.errors). + to include "jobs:rspec script can't be blank" end end end @@ -303,16 +303,16 @@ describe Gitlab::Ci::Config::Entry::Global do context 'when entry exists' do it 'returns correct entry' do - expect(global[:cache]) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Cache + expect(global[:cache]). + to be_an_instance_of Gitlab::Ci::Config::Entry::Cache expect(global[:jobs][:rspec][:script].value).to eq ['ls'] end end context 'when entry does not exist' do it 'always return unspecified node' do - expect(global[:some][:unknown][:node]) - .not_to be_specified + expect(global[:some][:unknown][:node]). + not_to be_specified end end end diff --git a/spec/lib/gitlab/ci/config/entry/image_spec.rb b/spec/lib/gitlab/ci/config/entry/image_spec.rb index 3c99cb0a1ee..062817e07fd 100644 --- a/spec/lib/gitlab/ci/config/entry/image_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/image_spec.rb @@ -31,8 +31,8 @@ describe Gitlab::Ci::Config::Entry::Image do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'image config should be a string' + expect(entry.errors). + to include 'image config should be a string' end end diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index d20f4ec207d..b90308a0515 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -44,8 +44,8 @@ describe Gitlab::Ci::Config::Entry::Job do describe '#errors' do it 'reports error about a config type' do - expect(entry.errors) - .to include 'job config should be a hash' + expect(entry.errors). + to include 'job config should be a hash' end end end @@ -138,8 +138,8 @@ describe Gitlab::Ci::Config::Entry::Job do end it 'returns correct value' do - expect(entry.value) - .to eq(name: :rspec, + expect(entry.value). + to eq(name: :rspec, before_script: %w[ls pwd], script: %w[rspec], commands: "ls\npwd\nrspec", diff --git a/spec/lib/gitlab/ci/config/entry/jobs_spec.rb b/spec/lib/gitlab/ci/config/entry/jobs_spec.rb index aaebf783962..c332b70dc71 100644 --- a/spec/lib/gitlab/ci/config/entry/jobs_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/jobs_spec.rb @@ -22,8 +22,8 @@ describe Gitlab::Ci::Config::Entry::Jobs do let(:config) { ['incorrect'] } it 'returns error about incorrect type' do - expect(entry.errors) - .to include 'jobs config should be a hash' + expect(entry.errors). + to include 'jobs config should be a hash' end end @@ -39,8 +39,8 @@ describe Gitlab::Ci::Config::Entry::Jobs do let(:config) { { '.hidden'.to_sym => { script: [] } } } it 'returns error about no visible jobs defined' do - expect(entry.errors) - .to include 'jobs config should contain at least one visible job' + expect(entry.errors). + to include 'jobs config should contain at least one visible job' end end end @@ -73,10 +73,10 @@ describe Gitlab::Ci::Config::Entry::Jobs do describe '#descendants' do it 'creates valid descendant nodes' do expect(entry.descendants.count).to eq 3 - expect(entry.descendants.first(2)) - .to all(be_an_instance_of(Gitlab::Ci::Config::Entry::Job)) - expect(entry.descendants.last) - .to be_an_instance_of(Gitlab::Ci::Config::Entry::Hidden) + expect(entry.descendants.first(2)). + to all(be_an_instance_of(Gitlab::Ci::Config::Entry::Job)) + expect(entry.descendants.last). + to be_an_instance_of(Gitlab::Ci::Config::Entry::Hidden) end end diff --git a/spec/lib/gitlab/ci/config/entry/key_spec.rb b/spec/lib/gitlab/ci/config/entry/key_spec.rb index a55e5b4b8ac..b1e563e0786 100644 --- a/spec/lib/gitlab/ci/config/entry/key_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/key_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Key do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'key config should be a string or symbol' + expect(entry.errors). + to include 'key config should be a string or symbol' end end end diff --git a/spec/lib/gitlab/ci/config/entry/paths_spec.rb b/spec/lib/gitlab/ci/config/entry/paths_spec.rb index e60c9aaf661..52f595e4b67 100644 --- a/spec/lib/gitlab/ci/config/entry/paths_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/paths_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Paths do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'paths config should be an array of strings' + expect(entry.errors). + to include 'paths config should be an array of strings' end end end diff --git a/spec/lib/gitlab/ci/config/entry/script_spec.rb b/spec/lib/gitlab/ci/config/entry/script_spec.rb index aa99cee2690..8c1305f376d 100644 --- a/spec/lib/gitlab/ci/config/entry/script_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/script_spec.rb @@ -31,8 +31,8 @@ describe Gitlab::Ci::Config::Entry::Script do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'script config should be an array of strings' + expect(entry.errors). + to include 'script config should be an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/services_spec.rb b/spec/lib/gitlab/ci/config/entry/services_spec.rb index 66fad3b6b16..c31a7c0ec3e 100644 --- a/spec/lib/gitlab/ci/config/entry/services_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/services_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Services do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'services config should be an array of strings' + expect(entry.errors). + to include 'services config should be an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/stage_spec.rb b/spec/lib/gitlab/ci/config/entry/stage_spec.rb index 70c8a0a355a..cefef7a805a 100644 --- a/spec/lib/gitlab/ci/config/entry/stage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/stage_spec.rb @@ -24,8 +24,8 @@ describe Gitlab::Ci::Config::Entry::Stage do let(:config) { { test: true } } it 'reports errors about wrong type' do - expect(stage.errors) - .to include 'stage config should be a string' + expect(stage.errors). + to include 'stage config should be a string' end end end diff --git a/spec/lib/gitlab/ci/config/entry/stages_spec.rb b/spec/lib/gitlab/ci/config/entry/stages_spec.rb index 182c8d867c7..bdcd6c98a85 100644 --- a/spec/lib/gitlab/ci/config/entry/stages_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/stages_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Stages do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'stages config should be an array of strings' + expect(entry.errors). + to include 'stages config should be an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb index e4ee44f1274..13b00a98b6a 100644 --- a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb @@ -47,8 +47,8 @@ describe Gitlab::Ci::Config::Entry::Trigger do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'trigger config should be an array of strings or regexps' + expect(entry.errors). + to include 'trigger config should be an array of strings or regexps' end end end diff --git a/spec/lib/gitlab/ci/config/entry/validatable_spec.rb b/spec/lib/gitlab/ci/config/entry/validatable_spec.rb index d1856801827..e31e85538b9 100644 --- a/spec/lib/gitlab/ci/config/entry/validatable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/validatable_spec.rb @@ -19,8 +19,8 @@ describe Gitlab::Ci::Config::Entry::Validatable do end it 'returns validator' do - expect(entry.validator.superclass) - .to be Gitlab::Ci::Config::Entry::Validator + expect(entry.validator.superclass). + to be Gitlab::Ci::Config::Entry::Validator end it 'returns only one validator to mitigate leaks' do diff --git a/spec/lib/gitlab/ci/config/entry/validator_spec.rb b/spec/lib/gitlab/ci/config/entry/validator_spec.rb index ad7e6f07d3c..c6e21cd67b0 100644 --- a/spec/lib/gitlab/ci/config/entry/validator_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/validator_spec.rb @@ -47,8 +47,8 @@ describe Gitlab::Ci::Config::Entry::Validator do it 'returns errors' do validator_instance.validate - expect(validator_instance.messages) - .to include "node test attribute can't be blank" + expect(validator_instance.messages). + to include "node test attribute can't be blank" end end end diff --git a/spec/lib/gitlab/ci/config/entry/variables_spec.rb b/spec/lib/gitlab/ci/config/entry/variables_spec.rb index 58327d08904..60aa510b746 100644 --- a/spec/lib/gitlab/ci/config/entry/variables_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/variables_spec.rb @@ -33,8 +33,8 @@ describe Gitlab::Ci::Config::Entry::Variables do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include /should be a hash of key value pairs/ + expect(entry.errors). + to include /should be a hash of key value pairs/ end end diff --git a/spec/lib/gitlab/ci/status/build/common_spec.rb b/spec/lib/gitlab/ci/status/build/common_spec.rb index 40b96b1807b..cd893a09748 100644 --- a/spec/lib/gitlab/ci/status/build/common_spec.rb +++ b/spec/lib/gitlab/ci/status/build/common_spec.rb @@ -6,9 +6,9 @@ describe Gitlab::Ci::Status::Build::Common do let(:project) { build.project } subject do - Gitlab::Ci::Status::Core - .new(build, user) - .extend(described_class) + Gitlab::Ci::Status::Core. + new(build, user). + extend(described_class) end describe '#has_action?' do diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index 0c40fca0c1a..3d1ebadadcc 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -16,8 +16,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable] end it 'fabricates a retryable build status' do @@ -42,8 +42,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable] end it 'fabricates a retryable build status' do @@ -67,8 +67,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable, + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable, Gitlab::Ci::Status::Build::FailedAllowed] end @@ -96,8 +96,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable] end it 'fabricates a retryable build status' do @@ -121,8 +121,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Cancelable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Cancelable] end it 'fabricates a canceable build status' do @@ -146,8 +146,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Cancelable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Cancelable] end it 'fabricates a cancelable build status' do @@ -196,8 +196,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Play] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Play] end it 'fabricates a core skipped status' do @@ -222,8 +222,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Stop] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Stop] end it 'fabricates a core skipped status' do diff --git a/spec/lib/gitlab/ci/status/extended_spec.rb b/spec/lib/gitlab/ci/status/extended_spec.rb index c2d74ca5cde..459044eb968 100644 --- a/spec/lib/gitlab/ci/status/extended_spec.rb +++ b/spec/lib/gitlab/ci/status/extended_spec.rb @@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Extended do end it 'requires subclass to implement matcher' do - expect { subject.matches?(double, double) } - .to raise_error(NotImplementedError) + expect { subject.matches?(double, double) }. + to raise_error(NotImplementedError) end end diff --git a/spec/lib/gitlab/ci/status/external/common_spec.rb b/spec/lib/gitlab/ci/status/external/common_spec.rb index 5a97d98b55f..6a564eeb8b7 100644 --- a/spec/lib/gitlab/ci/status/external/common_spec.rb +++ b/spec/lib/gitlab/ci/status/external/common_spec.rb @@ -10,9 +10,9 @@ describe Gitlab::Ci::Status::External::Common do end subject do - Gitlab::Ci::Status::Core - .new(external_status, user) - .extend(described_class) + Gitlab::Ci::Status::Core. + new(external_status, user). + extend(described_class) end describe '#has_action?' do diff --git a/spec/lib/gitlab/ci/status/factory_spec.rb b/spec/lib/gitlab/ci/status/factory_spec.rb index bbf9c7c83a3..45fd49b91ea 100644 --- a/spec/lib/gitlab/ci/status/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/factory_spec.rb @@ -84,15 +84,15 @@ describe Gitlab::Ci::Status::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [first_extended_status, second_extended_status] + expect(factory.extended_statuses). + to eq [first_extended_status, second_extended_status] end end context 'when exclusive statuses are matches' do before do - allow(described_class).to receive(:extended_statuses) - .and_return([[first_extended_status, second_extended_status]]) + allow(described_class).to receive(:extended_statuses). + and_return([[first_extended_status, second_extended_status]]) end it 'does not fabricate compound decorator' do @@ -116,8 +116,8 @@ describe Gitlab::Ci::Status::Factory do context 'when exclusive statuses are not matched' do before do - allow(described_class).to receive(:extended_statuses) - .and_return([[first_extended_status], [second_extended_status]]) + allow(described_class).to receive(:extended_statuses). + and_return([[first_extended_status], [second_extended_status]]) end it_behaves_like 'compound decorator factory' @@ -125,8 +125,8 @@ describe Gitlab::Ci::Status::Factory do context 'when using simplified status grouping' do before do - allow(described_class).to receive(:extended_statuses) - .and_return([first_extended_status, second_extended_status]) + allow(described_class).to receive(:extended_statuses). + and_return([first_extended_status, second_extended_status]) end it_behaves_like 'compound decorator factory' diff --git a/spec/lib/gitlab/ci/status/pipeline/common_spec.rb b/spec/lib/gitlab/ci/status/pipeline/common_spec.rb index d665674bf70..35dad60febf 100644 --- a/spec/lib/gitlab/ci/status/pipeline/common_spec.rb +++ b/spec/lib/gitlab/ci/status/pipeline/common_spec.rb @@ -6,9 +6,9 @@ describe Gitlab::Ci::Status::Pipeline::Common do let(:pipeline) { create(:ci_pipeline, project: project) } subject do - Gitlab::Ci::Status::Core - .new(pipeline, user) - .extend(described_class) + Gitlab::Ci::Status::Core. + new(pipeline, user). + extend(described_class) end describe '#has_action?' do @@ -29,8 +29,8 @@ describe Gitlab::Ci::Status::Pipeline::Common do describe '#details_path' do it 'links to the pipeline details page' do - expect(subject.details_path) - .to include "pipelines/#{pipeline.id}" + expect(subject.details_path). + to include "pipelines/#{pipeline.id}" end end end diff --git a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb index b10a447c27a..7cee4435931 100644 --- a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb @@ -34,8 +34,8 @@ describe Gitlab::Ci::Status::Pipeline::Factory do it 'extends core status with common pipeline methods' do expect(status).to have_details expect(status).not_to have_action - expect(status.details_path) - .to include "pipelines/#{pipeline.id}" + expect(status.details_path). + to include "pipelines/#{pipeline.id}" end end end @@ -55,8 +55,8 @@ describe Gitlab::Ci::Status::Pipeline::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::SuccessWarning] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::SuccessWarning] end it 'fabricates extended "success with warnings" status' do diff --git a/spec/lib/gitlab/ci/status/stage/common_spec.rb b/spec/lib/gitlab/ci/status/stage/common_spec.rb index 8814a7614a0..3b25893d8c7 100644 --- a/spec/lib/gitlab/ci/status/stage/common_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/common_spec.rb @@ -10,8 +10,8 @@ describe Gitlab::Ci::Status::Stage::Common do end subject do - Class.new(Gitlab::Ci::Status::Core) - .new(stage, user).extend(described_class) + Class.new(Gitlab::Ci::Status::Core). + new(stage, user).extend(described_class) end it 'does not have action' do @@ -19,10 +19,10 @@ describe Gitlab::Ci::Status::Stage::Common do end it 'links to the pipeline details page' do - expect(subject.details_path) - .to include "pipelines/#{pipeline.id}" - expect(subject.details_path) - .to include "##{stage.name}" + expect(subject.details_path). + to include "pipelines/#{pipeline.id}" + expect(subject.details_path). + to include "##{stage.name}" end context 'when user has permission to read pipeline' do diff --git a/spec/lib/gitlab/ci/status/stage/factory_spec.rb b/spec/lib/gitlab/ci/status/stage/factory_spec.rb index bbb40e2c1ab..c8503392b34 100644 --- a/spec/lib/gitlab/ci/status/stage/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/factory_spec.rb @@ -55,8 +55,8 @@ describe Gitlab::Ci::Status::Stage::Factory do end it 'fabricates extended "success with warnings" status' do - expect(status) - .to be_a Gitlab::Ci::Status::SuccessWarning + expect(status). + to be_a Gitlab::Ci::Status::SuccessWarning end it 'extends core status with common stage method' do diff --git a/spec/lib/gitlab/data_builder/note_spec.rb b/spec/lib/gitlab/data_builder/note_spec.rb index 04ec34492e1..7658153df0b 100644 --- a/spec/lib/gitlab/data_builder/note_spec.rb +++ b/spec/lib/gitlab/data_builder/note_spec.rb @@ -9,8 +9,8 @@ describe Gitlab::DataBuilder::Note, lib: true do before(:each) do expect(data).to have_key(:object_attributes) expect(data[:object_attributes]).to have_key(:url) - expect(data[:object_attributes][:url]) - .to eq(Gitlab::UrlBuilder.build(note)) + expect(data[:object_attributes][:url]). + to eq(Gitlab::UrlBuilder.build(note)) expect(data[:object_kind]).to eq('note') expect(data[:user]).to eq(user.hook_attrs) end @@ -49,10 +49,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and issue-specific data' do expect(data).to have_key(:issue) - expect(data[:issue].except('updated_at')) - .to eq(issue.reload.hook_attrs.except('updated_at')) - expect(data[:issue]['updated_at']) - .to be > issue.hook_attrs['updated_at'] + expect(data[:issue].except('updated_at')). + to eq(issue.reload.hook_attrs.except('updated_at')) + expect(data[:issue]['updated_at']). + to be > issue.hook_attrs['updated_at'] end include_examples 'project hook data' @@ -73,10 +73,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and merge request data' do expect(data).to have_key(:merge_request) - expect(data[:merge_request].except('updated_at')) - .to eq(merge_request.reload.hook_attrs.except('updated_at')) - expect(data[:merge_request]['updated_at']) - .to be > merge_request.hook_attrs['updated_at'] + expect(data[:merge_request].except('updated_at')). + to eq(merge_request.reload.hook_attrs.except('updated_at')) + expect(data[:merge_request]['updated_at']). + to be > merge_request.hook_attrs['updated_at'] end include_examples 'project hook data' @@ -96,10 +96,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and merge request diff data' do expect(data).to have_key(:merge_request) - expect(data[:merge_request].except('updated_at')) - .to eq(merge_request.reload.hook_attrs.except('updated_at')) - expect(data[:merge_request]['updated_at']) - .to be > merge_request.hook_attrs['updated_at'] + expect(data[:merge_request].except('updated_at')). + to eq(merge_request.reload.hook_attrs.except('updated_at')) + expect(data[:merge_request]['updated_at']). + to be > merge_request.hook_attrs['updated_at'] end include_examples 'project hook data' @@ -119,10 +119,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and project snippet data' do expect(data).to have_key(:snippet) - expect(data[:snippet].except('updated_at')) - .to eq(snippet.reload.hook_attrs.except('updated_at')) - expect(data[:snippet]['updated_at']) - .to be > snippet.hook_attrs['updated_at'] + expect(data[:snippet].except('updated_at')). + to eq(snippet.reload.hook_attrs.except('updated_at')) + expect(data[:snippet]['updated_at']). + to be > snippet.hook_attrs['updated_at'] end include_examples 'project hook data' diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index edd01d032c8..5eff7e8425b 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -120,8 +120,8 @@ describe Gitlab::Database, lib: true do pool = described_class.create_connection_pool(5) begin - expect(pool) - .to be_kind_of(ActiveRecord::ConnectionAdapters::ConnectionPool) + expect(pool). + to be_kind_of(ActiveRecord::ConnectionAdapters::ConnectionPool) expect(pool.spec.config[:pool]).to eq(5) ensure diff --git a/spec/lib/gitlab/import_export/avatar_restorer_spec.rb b/spec/lib/gitlab/import_export/avatar_restorer_spec.rb index 08a42fd27a2..c141762421f 100644 --- a/spec/lib/gitlab/import_export/avatar_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/avatar_restorer_spec.rb @@ -7,8 +7,8 @@ describe Gitlab::ImportExport::AvatarRestorer, lib: true do let(:project) { create(:empty_project) } before do - allow_any_instance_of(described_class).to receive(:avatar_export_file) - .and_return(uploaded_image_temp_path) + allow_any_instance_of(described_class).to receive(:avatar_export_file). + and_return(uploaded_image_temp_path) end after do diff --git a/spec/lib/gitlab/incoming_email_spec.rb b/spec/lib/gitlab/incoming_email_spec.rb index 698bd72d0f8..06d39d5c782 100644 --- a/spec/lib/gitlab/incoming_email_spec.rb +++ b/spec/lib/gitlab/incoming_email_spec.rb @@ -99,8 +99,8 @@ describe Gitlab::IncomingEmail, lib: true do end it 'returns reply key' do - expect(described_class.scan_fallback_references(references)) - .to eq(%w[issue_1@localhost + expect(described_class.scan_fallback_references(references)). + to eq(%w[issue_1@localhost reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost exchange@microsoft.com]) end diff --git a/spec/lib/gitlab/ldap/adapter_spec.rb b/spec/lib/gitlab/ldap/adapter_spec.rb index 563c074017a..fe3709f30e1 100644 --- a/spec/lib/gitlab/ldap/adapter_spec.rb +++ b/spec/lib/gitlab/ldap/adapter_spec.rb @@ -34,8 +34,8 @@ describe Gitlab::LDAP::Adapter, lib: true do end it 'searches with the proper options when searching with a limit' do - expect(adapter) - .to receive(:ldap_search).with(hash_including(size: 100)).and_return({}) + expect(adapter). + to receive(:ldap_search).with(hash_including(size: 100)).and_return({}) adapter.users('uid', 'johndoe', 100) end diff --git a/spec/lib/gitlab/o_auth/user_spec.rb b/spec/lib/gitlab/o_auth/user_spec.rb index fc9e1cb430a..8d9352350f0 100644 --- a/spec/lib/gitlab/o_auth/user_spec.rb +++ b/spec/lib/gitlab/o_auth/user_spec.rb @@ -184,8 +184,8 @@ describe Gitlab::OAuth::User, lib: true do oauth_user.save identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } - expect(identities_as_hash) - .to match_array( + expect(identities_as_hash). + to match_array( [ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, { provider: 'twitter', extern_uid: uid } diff --git a/spec/lib/gitlab/serializer/pagination_spec.rb b/spec/lib/gitlab/serializer/pagination_spec.rb index 519eb1b274f..e05160da7a6 100644 --- a/spec/lib/gitlab/serializer/pagination_spec.rb +++ b/spec/lib/gitlab/serializer/pagination_spec.rb @@ -6,11 +6,11 @@ describe Gitlab::Serializer::Pagination do let(:headers) { spy('headers') } before do - allow(request).to receive(:query_parameters) - .and_return(params) + allow(request).to receive(:query_parameters). + and_return(params) - allow(response).to receive(:headers) - .and_return(headers) + allow(response).to receive(:headers). + and_return(headers) end let(:pagination) { described_class.new(request, response) } diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index b950fcdd81a..53011008f44 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -32,9 +32,9 @@ describe ApplicationSetting, models: true do it { is_expected.to validate_presence_of(:max_attachment_size) } it do - is_expected.to validate_numericality_of(:max_attachment_size) - .only_integer - .is_greater_than(0) + is_expected.to validate_numericality_of(:max_attachment_size). + only_integer. + is_greater_than(0) end it_behaves_like 'an object with email-formated attributes', :admin_notification_email do diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 2dfca8bcfce..2725c63f13b 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -212,15 +212,15 @@ describe Ci::Build, :models do retried_rspec = Ci::Build.retry(rspec_test, user) - expect(staging.depends_on_builds.map(&:id)) - .to contain_exactly(build.id, retried_rspec.id, rubocop_test.id) + expect(staging.depends_on_builds.map(&:id)). + to contain_exactly(build.id, retried_rspec.id, rubocop_test.id) end end describe '#detailed_status' do it 'returns a detailed status' do - expect(build.detailed_status(user)) - .to be_a Gitlab::Ci::Status::Build::Cancelable + expect(build.detailed_status(user)). + to be_a Gitlab::Ci::Status::Build::Cancelable end end @@ -1151,8 +1151,8 @@ describe Ci::Build, :models do let!(:build) { create(:ci_build, artifacts_size: 23) } it 'updates project statistics when the artifact size changes' do - expect(ProjectCacheWorker).to receive(:perform_async) - .with(build.project_id, [], [:build_artifacts_size]) + expect(ProjectCacheWorker).to receive(:perform_async). + with(build.project_id, [], [:build_artifacts_size]) build.artifacts_size = 42 build.save! @@ -1166,8 +1166,8 @@ describe Ci::Build, :models do end it 'updates project statistics when the build is destroyed' do - expect(ProjectCacheWorker).to receive(:perform_async) - .with(build.project_id, [], [:build_artifacts_size]) + expect(ProjectCacheWorker).to receive(:perform_async). + with(build.project_id, [], [:build_artifacts_size]) build.destroy end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 36533bdd11e..f770e6a9e34 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -253,8 +253,8 @@ describe CommitStatus, :models do let(:user) { create(:user) } it 'returns a detailed status' do - expect(commit_status.detailed_status(user)) - .to be_a Gitlab::Ci::Status::Success + expect(commit_status.detailed_status(user)). + to be_a Gitlab::Ci::Status::Success end end diff --git a/spec/models/email_spec.rb b/spec/models/email_spec.rb index fe4de1b2afb..4652af1cb97 100644 --- a/spec/models/email_spec.rb +++ b/spec/models/email_spec.rb @@ -8,7 +8,7 @@ describe Email, models: true do end it 'normalize email value' do - expect(described_class.new(email: ' inFO@exAMPLe.com ').email) - .to eq 'info@example.com' + expect(described_class.new(email: ' inFO@exAMPLe.com ').email). + to eq 'info@example.com' end end diff --git a/spec/models/group_label_spec.rb b/spec/models/group_label_spec.rb index 555a876daeb..c8d88022ec7 100644 --- a/spec/models/group_label_spec.rb +++ b/spec/models/group_label_spec.rb @@ -49,8 +49,8 @@ describe GroupLabel, models: true do context 'using invalid format' do it 'raises error' do - expect { label.to_reference(format: :invalid) } - .to raise_error StandardError, /Unknown format/ + expect { label.to_reference(format: :invalid) }. + to raise_error StandardError, /Unknown format/ end end end diff --git a/spec/models/lfs_objects_project_spec.rb b/spec/models/lfs_objects_project_spec.rb index 7bc278e350f..a2031beeab2 100644 --- a/spec/models/lfs_objects_project_spec.rb +++ b/spec/models/lfs_objects_project_spec.rb @@ -18,8 +18,8 @@ describe LfsObjectsProject, models: true do describe '#update_project_statistics' do it 'updates project statistics when the object is added' do - expect(ProjectCacheWorker).to receive(:perform_async) - .with(project.id, [], [:lfs_objects_size]) + expect(ProjectCacheWorker).to receive(:perform_async). + with(project.id, [], [:lfs_objects_size]) subject.save! end @@ -27,8 +27,8 @@ describe LfsObjectsProject, models: true do it 'updates project statistics when the object is removed' do subject.save! - expect(ProjectCacheWorker).to receive(:perform_async) - .with(project.id, [], [:lfs_objects_size]) + expect(ProjectCacheWorker).to receive(:perform_async). + with(project.id, [], [:lfs_objects_size]) subject.destroy end diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb index 6d599e148a2..1b7360257e8 100644 --- a/spec/models/merge_request_diff_spec.rb +++ b/spec/models/merge_request_diff_spec.rb @@ -84,8 +84,8 @@ describe MergeRequestDiff, models: true do end it 'saves overflow state' do - allow(Commit).to receive(:max_diff_options) - .and_return(max_lines: 0, max_files: 0) + allow(Commit).to receive(:max_diff_options). + and_return(max_lines: 0, max_files: 0) mr_diff = create(:merge_request).merge_request_diff @@ -93,8 +93,8 @@ describe MergeRequestDiff, models: true do end it 'saves empty state' do - allow_any_instance_of(MergeRequestDiff).to receive(:commits) - .and_return([]) + allow_any_instance_of(MergeRequestDiff).to receive(:commits). + and_return([]) mr_diff = create(:merge_request).merge_request_diff diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index a01741a9971..810c08256dc 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -412,15 +412,15 @@ describe MergeRequest, models: true do it 'includes merge information as the title' do request = build(:merge_request, source_branch: 'source', target_branch: 'target') - expect(request.merge_commit_message) - .to match("Merge branch 'source' into 'target'\n\n") + expect(request.merge_commit_message). + to match("Merge branch 'source' into 'target'\n\n") end it 'includes its title in the body' do request = build(:merge_request, title: 'Remove all technical debt') - expect(request.merge_commit_message) - .to match("Remove all technical debt\n\n") + expect(request.merge_commit_message). + to match("Remove all technical debt\n\n") end it 'includes its closed issues in the body' do @@ -432,15 +432,15 @@ describe MergeRequest, models: true do allow(subject.project).to receive(:default_branch). and_return(subject.target_branch) - expect(subject.merge_commit_message) - .to match("Closes #{issue.to_reference}") + expect(subject.merge_commit_message). + to match("Closes #{issue.to_reference}") end it 'includes its reference in the body' do request = build_stubbed(:merge_request) - expect(request.merge_commit_message) - .to match("See merge request #{request.to_reference}") + expect(request.merge_commit_message). + to match("See merge request #{request.to_reference}") end it 'excludes multiple linebreak runs when description is blank' do @@ -452,15 +452,15 @@ describe MergeRequest, models: true do it 'includes its description in the body' do request = build(:merge_request, description: 'By removing all code') - expect(request.merge_commit_message(include_description: true)) - .to match("By removing all code\n\n") + expect(request.merge_commit_message(include_description: true)). + to match("By removing all code\n\n") end it 'does not includes its description in the body' do request = build(:merge_request, description: 'By removing all code') - expect(request.merge_commit_message) - .not_to match("By removing all code\n\n") + expect(request.merge_commit_message). + not_to match("By removing all code\n\n") end end diff --git a/spec/models/project_label_spec.rb b/spec/models/project_label_spec.rb index 9cdbfa44e5b..3e9dd3758ed 100644 --- a/spec/models/project_label_spec.rb +++ b/spec/models/project_label_spec.rb @@ -94,8 +94,8 @@ describe ProjectLabel, models: true do context 'using invalid format' do it 'raises error' do - expect { label.to_reference(format: :invalid) } - .to raise_error StandardError, /Unknown format/ + expect { label.to_reference(format: :invalid) }. + to raise_error StandardError, /Unknown format/ end end @@ -104,15 +104,15 @@ describe ProjectLabel, models: true do context 'using name' do it 'returns cross reference with label name' do - expect(label.to_reference(project, format: :name)) - .to eq %Q(#{label.project.path_with_namespace}~"#{label.name}") + expect(label.to_reference(project, format: :name)). + to eq %Q(#{label.project.path_with_namespace}~"#{label.name}") end end context 'using id' do it 'returns cross reference with label id' do - expect(label.to_reference(project, format: :id)) - .to eq %Q(#{label.project.path_with_namespace}~#{label.id}) + expect(label.to_reference(project, format: :id)). + to eq %Q(#{label.project.path_with_namespace}~#{label.id}) end end end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 838fd3754b2..0d1db97cd5b 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -265,8 +265,8 @@ describe Repository, models: true do describe '#commit' do context 'when ref exists' do it 'returns commit object' do - expect(repository.commit('master')) - .to be_an_instance_of Commit + expect(repository.commit('master')). + to be_an_instance_of Commit end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 584a4facd94..42029b15f4e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1148,8 +1148,8 @@ describe User, models: true do user = create(:user) project = create(:empty_project, :private, namespace: user.namespace) - expect(user.authorized_projects(Gitlab::Access::REPORTER)) - .to contain_exactly(project) + expect(user.authorized_projects(Gitlab::Access::REPORTER)). + to contain_exactly(project) end it 'includes projects for which the user is a master' do @@ -1158,8 +1158,8 @@ describe User, models: true do project.team << [user, Gitlab::Access::MASTER] - expect(user.authorized_projects(Gitlab::Access::REPORTER)) - .to contain_exactly(project) + expect(user.authorized_projects(Gitlab::Access::REPORTER)). + to contain_exactly(project) end end diff --git a/spec/requests/api/broadcast_messages_spec.rb b/spec/requests/api/broadcast_messages_spec.rb index 921d8714173..576eb80605b 100644 --- a/spec/requests/api/broadcast_messages_spec.rb +++ b/spec/requests/api/broadcast_messages_spec.rb @@ -27,8 +27,8 @@ describe API::BroadcastMessages, api: true do expect(response).to have_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_kind_of(Array) - expect(json_response.first.keys) - .to match_array(%w(id message starts_at ends_at color font active)) + expect(json_response.first.keys). + to match_array(%w(id message starts_at ends_at color font active)) end end @@ -52,8 +52,8 @@ describe API::BroadcastMessages, api: true do expect(response).to have_http_status(200) expect(json_response['id']).to eq message.id - expect(json_response.keys) - .to match_array(%w(id message starts_at ends_at color font active)) + expect(json_response.keys). + to match_array(%w(id message starts_at ends_at color font active)) end end @@ -174,8 +174,8 @@ describe API::BroadcastMessages, api: true do end it 'deletes the broadcast message for admins' do - expect { delete api("/broadcast_messages/#{message.id}", admin) } - .to change { BroadcastMessage.count }.by(-1) + expect { delete api("/broadcast_messages/#{message.id}", admin) }. + to change { BroadcastMessage.count }.by(-1) end end end diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb index 81a8856b8f1..eface28976e 100644 --- a/spec/requests/api/commit_statuses_spec.rb +++ b/spec/requests/api/commit_statuses_spec.rb @@ -207,8 +207,8 @@ describe API::CommitStatuses, api: true do it 'responds with bad request status and validation errors' do expect(response).to have_http_status(400) - expect(json_response['message']['target_url']) - .to include 'must be a valid URL' + expect(json_response['message']['target_url']). + to include 'must be a valid URL' end end end diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index a59112579e5..ff2e0d58d2a 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -36,8 +36,8 @@ describe API::Groups, api: true do expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.length).to eq(1) - expect(json_response) - .to satisfy_one { |group| group['name'] == group1.name } + expect(json_response). + to satisfy_one { |group| group['name'] == group1.name } end it "does not include statistics" do @@ -84,8 +84,8 @@ describe API::Groups, api: true do expect(response).to have_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array - expect(json_response) - .to satisfy_one { |group| group['statistics'] == attributes } + expect(json_response). + to satisfy_one { |group| group['statistics'] == attributes } end end diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index ffeacb15f17..d1e765d1fdd 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -74,8 +74,8 @@ describe API::Internal, api: true do context 'when two-factor is enabled' do it 'returns new recovery codes when the user exists' do allow_any_instance_of(User).to receive(:two_factor_enabled?).and_return(true) - allow_any_instance_of(User) - .to receive(:generate_otp_backup_codes!).and_return(%w(119135e5a3ebce8e 34bd7b74adbc8861)) + allow_any_instance_of(User). + to receive(:generate_otp_backup_codes!).and_return(%w(119135e5a3ebce8e 34bd7b74adbc8861)) post api('/internal/two_factor_recovery_codes'), secret_token: secret_token, diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index 103d6755888..2e596f4197e 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -202,8 +202,8 @@ describe API::Runners, api: true do expect(shared_runner.tag_list).to include('ruby2.1', 'pgsql', 'mysql') expect(shared_runner.run_untagged?).to be(false) expect(shared_runner.locked?).to be(true) - expect(shared_runner.ensure_runner_queue_value) - .not_to eq(runner_queue_value) + expect(shared_runner.ensure_runner_queue_value). + not_to eq(runner_queue_value) end end @@ -218,8 +218,8 @@ describe API::Runners, api: true do expect(response).to have_http_status(200) expect(specific_runner.description).to eq('test') expect(specific_runner.description).not_to eq(description) - expect(specific_runner.ensure_runner_queue_value) - .not_to eq(runner_queue_value) + expect(specific_runner.ensure_runner_queue_value). + not_to eq(runner_queue_value) end end diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index d85afdeab42..03b860ae54e 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -38,8 +38,8 @@ describe Ci::API::Builds do it 'gives 204 and set the same X-GitLab-Last-Update' do expect(response).to have_http_status(204) - expect(response.header['X-GitLab-Last-Update']) - .to eq(last_update) + expect(response.header['X-GitLab-Last-Update']). + to eq(last_update) end end @@ -49,8 +49,8 @@ describe Ci::API::Builds do it 'gives 204 and set a new X-GitLab-Last-Update' do expect(response).to have_http_status(204) - expect(response.header['X-GitLab-Last-Update']) - .to eq(new_update) + expect(response.header['X-GitLab-Last-Update']). + to eq(new_update) end end @@ -260,8 +260,8 @@ describe Ci::API::Builds do end it 'does not update runner info' do - expect { register_builds } - .not_to change { runner.reload.contacted_at } + expect { register_builds }. + not_to change { runner.reload.contacted_at } end end diff --git a/spec/serializers/analytics_build_serializer_spec.rb b/spec/serializers/analytics_build_serializer_spec.rb index e3b1dd93dc2..c8bad5ef105 100644 --- a/spec/serializers/analytics_build_serializer_spec.rb +++ b/spec/serializers/analytics_build_serializer_spec.rb @@ -7,8 +7,8 @@ describe AnalyticsBuildSerializer do context 'when there is a single object provided' do it 'contains important elements of analyticsBuild' do - expect(subject) - .to include(:name, :branch, :short_sha, :date, :total_time, :url, :author) + expect(subject). + to include(:name, :branch, :short_sha, :date, :total_time, :url, :author) end end end diff --git a/spec/serializers/analytics_issue_serializer_spec.rb b/spec/serializers/analytics_issue_serializer_spec.rb index 2f08958a783..fe26b001740 100644 --- a/spec/serializers/analytics_issue_serializer_spec.rb +++ b/spec/serializers/analytics_issue_serializer_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe AnalyticsIssueSerializer do subject do - described_class - .new(project: project, entity: :merge_request) - .represent(resource) + described_class. + new(project: project, entity: :merge_request). + represent(resource) end let(:user) { create(:user) } diff --git a/spec/serializers/analytics_merge_request_serializer_spec.rb b/spec/serializers/analytics_merge_request_serializer_spec.rb index 62067cc0ef2..ee08762d237 100644 --- a/spec/serializers/analytics_merge_request_serializer_spec.rb +++ b/spec/serializers/analytics_merge_request_serializer_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe AnalyticsMergeRequestSerializer do subject do - described_class - .new(project: project, entity: :merge_request) - .represent(resource) + described_class. + new(project: project, entity: :merge_request). + represent(resource) end let(:user) { create(:user) } diff --git a/spec/serializers/analytics_summary_serializer_spec.rb b/spec/serializers/analytics_summary_serializer_spec.rb index 5d7a94c2d02..3106af0ded7 100644 --- a/spec/serializers/analytics_summary_serializer_spec.rb +++ b/spec/serializers/analytics_summary_serializer_spec.rb @@ -9,13 +9,13 @@ describe AnalyticsSummarySerializer do let(:user) { create(:user) } let(:resource) do - Gitlab::CycleAnalytics::Summary::Issue - .new(project: double, from: 1.day.ago, current_user: user) + Gitlab::CycleAnalytics::Summary::Issue. + new(project: double, from: 1.day.ago, current_user: user) end before do - allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue) - .to receive(:value).and_return(1.12) + allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue). + to receive(:value).and_return(1.12) end it 'it generates payload for single object' do diff --git a/spec/serializers/build_artifact_entity_spec.rb b/spec/serializers/build_artifact_entity_spec.rb index 2fc60aa9de6..6ccea199376 100644 --- a/spec/serializers/build_artifact_entity_spec.rb +++ b/spec/serializers/build_artifact_entity_spec.rb @@ -15,8 +15,8 @@ describe BuildArtifactEntity do end it 'contains path to the artifacts' do - expect(subject[:path]) - .to include "builds/#{build.id}/artifacts/download" + expect(subject[:path]). + to include "builds/#{build.id}/artifacts/download" end end end diff --git a/spec/serializers/commit_entity_spec.rb b/spec/serializers/commit_entity_spec.rb index 0333d73b5b5..895aeb30035 100644 --- a/spec/serializers/commit_entity_spec.rb +++ b/spec/serializers/commit_entity_spec.rb @@ -42,8 +42,8 @@ describe CommitEntity do end it 'needs to receive project in the request' do - expect(request).to receive(:project) - .and_return(project) + expect(request).to receive(:project). + and_return(project) subject end diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index 6a6df377b35..61b2fce8e8a 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -5,9 +5,9 @@ describe EnvironmentSerializer do let(:project) { create(:project) } let(:json) do - described_class - .new(user: user, project: project) - .represent(resource) + described_class. + new(user: user, project: project). + represent(resource) end context 'when there is a single object provided' do @@ -27,15 +27,15 @@ describe EnvironmentSerializer do let(:resource) { deployment.environment } it 'contains important elements of environment' do - expect(json) - .to include(:name, :external_url, :environment_path, :last_deployment) + expect(json). + to include(:name, :external_url, :environment_path, :last_deployment) end it 'contains relevant information about last deployment' do last_deployment = json.fetch(:last_deployment) - expect(last_deployment) - .to include(:ref, :user, :commit, :deployable, :manual_actions) + expect(last_deployment). + to include(:ref, :user, :commit, :deployable, :manual_actions) end end @@ -44,8 +44,8 @@ describe EnvironmentSerializer do let(:resource) { create_list(:environment, 2) } it 'contains important elements of environment' do - expect(json.first) - .to include(:last_deployment, :name, :external_url) + expect(json.first). + to include(:last_deployment, :name, :external_url) end it 'generates payload for collection' do @@ -122,13 +122,13 @@ describe EnvironmentSerializer do let(:pagination) { { page: 1, per_page: 2 } } let(:serializer) do - described_class.new(project: project) - .with_pagination(request, response) + described_class.new(project: project). + with_pagination(request, response) end before do - allow(request).to receive(:query_parameters) - .and_return(pagination) + allow(request).to receive(:query_parameters). + and_return(pagination) end subject { serializer.represent(resource) } @@ -164,9 +164,9 @@ describe EnvironmentSerializer do context 'when grouping environments within folders' do let(:serializer) do - described_class.new(project: project) - .with_pagination(request, response) - .within_folders + described_class.new(project: project). + with_pagination(request, response). + within_folders end before do diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/pipeline_entity_spec.rb index ccb72973f9c..96ef1d3c071 100644 --- a/spec/serializers/pipeline_entity_spec.rb +++ b/spec/serializers/pipeline_entity_spec.rb @@ -26,17 +26,17 @@ describe PipelineEntity do it 'contains details' do expect(subject).to include :details - expect(subject[:details]) - .to include :duration, :finished_at - expect(subject[:details]) - .to include :stages, :artifacts, :manual_actions + expect(subject[:details]). + to include :duration, :finished_at + expect(subject[:details]). + to include :stages, :artifacts, :manual_actions expect(subject[:details][:status]).to include :icon, :text, :label end it 'contains flags' do expect(subject).to include :flags - expect(subject[:flags]) - .to include :latest, :triggered, :stuck, + expect(subject[:flags]). + to include :latest, :triggered, :stuck, :yaml_errors, :retryable, :cancelable end end diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index 2aaef03cb93..5f84a98f06d 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -38,14 +38,14 @@ describe PipelineSerializer do let(:pagination) { {} } before do - allow(request) - .to receive(:query_parameters) - .and_return(pagination) + allow(request). + to receive(:query_parameters). + and_return(pagination) end let(:serializer) do - described_class.new(user: user) - .with_pagination(request, response) + described_class.new(user: user). + with_pagination(request, response) end it 'created a paginated serializer' do diff --git a/spec/serializers/request_aware_entity_spec.rb b/spec/serializers/request_aware_entity_spec.rb index aa666b961dc..94dbf02aee8 100644 --- a/spec/serializers/request_aware_entity_spec.rb +++ b/spec/serializers/request_aware_entity_spec.rb @@ -14,8 +14,8 @@ describe RequestAwareEntity do end it 'fetches request from options' do - expect(subject).to receive(:options) - .and_return({ request: 'some value' }) + expect(subject).to receive(:options). + and_return({ request: 'some value' }) expect(subject.request).to eq 'some value' end diff --git a/spec/serializers/stage_entity_spec.rb b/spec/serializers/stage_entity_spec.rb index 4ab40d08432..42f19935453 100644 --- a/spec/serializers/stage_entity_spec.rb +++ b/spec/serializers/stage_entity_spec.rb @@ -35,13 +35,13 @@ describe StageEntity do end it 'contains path to the stage' do - expect(subject[:path]) - .to include "pipelines/#{pipeline.id}##{stage.name}" + expect(subject[:path]). + to include "pipelines/#{pipeline.id}##{stage.name}" end it 'contains path to the stage dropdown' do - expect(subject[:dropdown_path]) - .to include "pipelines/#{pipeline.id}/stage.json?stage=test" + expect(subject[:dropdown_path]). + to include "pipelines/#{pipeline.id}/stage.json?stage=test" end it 'contains stage title' do diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index ef2ddc4b1d7..ce691004178 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -284,14 +284,14 @@ describe Ci::ProcessPipelineService, :services do pipeline.builds.running_or_pending.each(&:success) - expect(builds.pluck(:name)) - .to contain_exactly('build:1', 'build:2', 'test:1', 'test:2') + expect(builds.pluck(:name)). + to contain_exactly('build:1', 'build:2', 'test:1', 'test:2') pipeline.builds.find_by(name: 'test:1').success pipeline.builds.find_by(name: 'test:2').drop - expect(builds.pluck(:name)) - .to contain_exactly('build:1', 'build:2', 'test:1', 'test:2') + expect(builds.pluck(:name)). + to contain_exactly('build:1', 'build:2', 'test:1', 'test:2') Ci::Build.retry(pipeline.builds.find_by(name: 'test:2'), user).success diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index d03f7505eac..6499c7ad63e 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -61,8 +61,8 @@ describe Ci::RetryBuildService, :services do end it 'resolves todos for old build that failed' do - expect(MergeRequests::AddTodoWhenBuildFailsService) - .to receive_message_chain(:new, :close) + expect(MergeRequests::AddTodoWhenBuildFailsService). + to receive_message_chain(:new, :close) service.execute(build) end @@ -82,8 +82,8 @@ describe Ci::RetryBuildService, :services do context 'when user does not have ability to execute build' do it 'raises an error' do - expect { service.execute(build) } - .to raise_error Gitlab::Access::AccessDeniedError + expect { service.execute(build) }. + to raise_error Gitlab::Access::AccessDeniedError end end end @@ -109,8 +109,8 @@ describe Ci::RetryBuildService, :services do context 'when user does not have ability to execute build' do it 'raises an error' do - expect { service.reprocess(build) } - .to raise_error Gitlab::Access::AccessDeniedError + expect { service.reprocess(build) }. + to raise_error Gitlab::Access::AccessDeniedError end end end diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb index c0af8b8450a..84915b5f1aa 100644 --- a/spec/services/ci/retry_pipeline_service_spec.rb +++ b/spec/services/ci/retry_pipeline_service_spec.rb @@ -134,8 +134,8 @@ describe Ci::RetryPipelineService, '#execute', :services do end it 'closes all todos about failed jobs for pipeline' do - expect(MergeRequests::AddTodoWhenBuildFailsService) - .to receive_message_chain(:new, :close_all) + expect(MergeRequests::AddTodoWhenBuildFailsService). + to receive_message_chain(:new, :close_all) service.execute(pipeline) end @@ -149,8 +149,8 @@ describe Ci::RetryPipelineService, '#execute', :services do context 'when user is not allowed to retry pipeline' do it 'raises an error' do - expect { service.execute(pipeline) } - .to raise_error Gitlab::Access::AccessDeniedError + expect { service.execute(pipeline) }. + to raise_error Gitlab::Access::AccessDeniedError end end diff --git a/spec/services/ci/stop_environments_service_spec.rb b/spec/services/ci/stop_environments_service_spec.rb index 560f83d94f7..23e0856fecd 100644 --- a/spec/services/ci/stop_environments_service_spec.rb +++ b/spec/services/ci/stop_environments_service_spec.rb @@ -44,8 +44,8 @@ describe Ci::StopEnvironmentsService, services: true do context 'when environment is not stopped' do before do - allow_any_instance_of(Environment) - .to receive(:state).and_return(:stopped) + allow_any_instance_of(Environment). + to receive(:state).and_return(:stopped) end it 'does not stop environment' do @@ -83,22 +83,22 @@ describe Ci::StopEnvironmentsService, services: true do context 'when environment does not exist' do it 'does not raise error' do - expect { service.execute('master') } - .not_to raise_error + expect { service.execute('master') }. + not_to raise_error end end end def expect_environment_stopped_on(branch) - expect_any_instance_of(Environment) - .to receive(:stop!) + expect_any_instance_of(Environment). + to receive(:stop!) service.execute(branch) end def expect_environment_not_stopped_on(branch) - expect_any_instance_of(Environment) - .not_to receive(:stop!) + expect_any_instance_of(Environment). + not_to receive(:stop!) service.execute(branch) end diff --git a/spec/services/ci/update_build_queue_service_spec.rb b/spec/services/ci/update_build_queue_service_spec.rb index f01a388b895..14092d9dcca 100644 --- a/spec/services/ci/update_build_queue_service_spec.rb +++ b/spec/services/ci/update_build_queue_service_spec.rb @@ -12,15 +12,15 @@ describe Ci::UpdateBuildQueueService, :services do before { build.project.runners << runner } it 'ticks runner queue value' do - expect { subject.execute(build) } - .to change { runner.ensure_runner_queue_value } + expect { subject.execute(build) }. + to change { runner.ensure_runner_queue_value } end end context 'when there are no runners that can pick build' do it 'does not tick runner queue value' do - expect { subject.execute(build) } - .not_to change { runner.ensure_runner_queue_value } + expect { subject.execute(build) }. + not_to change { runner.ensure_runner_queue_value } end end end @@ -30,8 +30,8 @@ describe Ci::UpdateBuildQueueService, :services do context 'when there are runner that can pick build' do it 'ticks runner queue value' do - expect { subject.execute(build) } - .to change { runner.ensure_runner_queue_value } + expect { subject.execute(build) }. + to change { runner.ensure_runner_queue_value } end end @@ -39,8 +39,8 @@ describe Ci::UpdateBuildQueueService, :services do before { build.tag_list = [:docker] } it 'does not tick runner queue value' do - expect { subject.execute(build) } - .not_to change { runner.ensure_runner_queue_value } + expect { subject.execute(build) }. + not_to change { runner.ensure_runner_queue_value } end end end diff --git a/spec/services/issuable/bulk_update_service_spec.rb b/spec/services/issuable/bulk_update_service_spec.rb index 0475f38fe5e..87da8581e68 100644 --- a/spec/services/issuable/bulk_update_service_spec.rb +++ b/spec/services/issuable/bulk_update_service_spec.rb @@ -5,8 +5,8 @@ describe Issuable::BulkUpdateService, services: true do let(:project) { create(:empty_project, namespace: user.namespace) } def bulk_update(issues, extra_params = {}) - bulk_update_params = extra_params - .reverse_merge(issuable_ids: Array(issues).map(&:id).join(',')) + bulk_update_params = extra_params. + reverse_merge(issuable_ids: Array(issues).map(&:id).join(',')) Issuable::BulkUpdateService.new(project, user, bulk_update_params).execute('issue') end @@ -65,22 +65,22 @@ describe Issuable::BulkUpdateService, services: true do assignee = create(:user) project.team << [assignee, :developer] - expect { bulk_update(issue, assignee_id: assignee.id) } - .to change { issue.reload.assignee }.from(user).to(assignee) + expect { bulk_update(issue, assignee_id: assignee.id) }. + to change { issue.reload.assignee }.from(user).to(assignee) end end context "when the new assignee ID is #{IssuableFinder::NONE}" do it "unassigns the issues" do - expect { bulk_update(issue, assignee_id: IssuableFinder::NONE) } - .to change { issue.reload.assignee }.to(nil) + expect { bulk_update(issue, assignee_id: IssuableFinder::NONE) }. + to change { issue.reload.assignee }.to(nil) end end context 'when the new assignee ID is not present' do it 'does not unassign' do - expect { bulk_update(issue, assignee_id: nil) } - .not_to change { issue.reload.assignee } + expect { bulk_update(issue, assignee_id: nil) }. + not_to change { issue.reload.assignee } end end end @@ -97,8 +97,8 @@ describe Issuable::BulkUpdateService, services: true do end it 'updates the issue milestone' do - expect { bulk_update(issue, milestone_id: milestone.id) } - .to change { issue.reload.milestone }.from(nil).to(milestone) + expect { bulk_update(issue, milestone_id: milestone.id) }. + to change { issue.reload.milestone }.from(nil).to(milestone) end end diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index db196ed5751..59c0fa50994 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -188,8 +188,8 @@ describe Issues::MoveService, services: true do let(:new_note) { new_issue.notes.first } it 'rewrites references using a cross reference to old project' do - expect(new_note.note) - .to eq "Note with reference to merge request #{old_project.to_reference(new_project)}!1" + expect(new_note.note). + to eq "Note with reference to merge request #{old_project.to_reference(new_project)}!1" end end @@ -201,8 +201,8 @@ describe Issues::MoveService, services: true do it 'rewrites uploads in description' do expect(new_issue.description).not_to eq description - expect(new_issue.description) - .to match(/Text and #{FileUploader::MARKDOWN_PATTERN}/) + expect(new_issue.description). + to match(/Text and #{FileUploader::MARKDOWN_PATTERN}/) expect(new_issue.description).not_to include uploader.secret end end @@ -216,8 +216,8 @@ describe Issues::MoveService, services: true do let(:description) { "Some description #{another_issue.to_reference}" } it 'rewrites referenced issues creating cross project reference' do - expect(new_issue.description) - .to eq "Some description #{another_issue.to_reference(new_project)}" + expect(new_issue.description). + to eq "Some description #{another_issue.to_reference(new_project)}" end end @@ -226,8 +226,8 @@ describe Issues::MoveService, services: true do let(:description) { "Some description #{user.to_reference}" } it "doesn't throw any errors for issues containing user references" do - expect(new_issue.description) - .to eq "Some description #{user.to_reference}" + expect(new_issue.description). + to eq "Some description #{user.to_reference}" end end end @@ -236,8 +236,8 @@ describe Issues::MoveService, services: true do let(:new_project) { old_project } it 'raises error' do - expect { move_service.execute(old_issue, new_project) } - .to raise_error(StandardError, /Cannot move issue/) + expect { move_service.execute(old_issue, new_project) }. + to raise_error(StandardError, /Cannot move issue/) end end end diff --git a/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb b/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb index d80fb8a1af1..881458c190f 100644 --- a/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb +++ b/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb @@ -29,9 +29,9 @@ describe MergeRequests::AddTodoWhenBuildFailsService do end before do - allow_any_instance_of(MergeRequest) - .to receive(:head_pipeline) - .and_return(pipeline) + allow_any_instance_of(MergeRequest). + to receive(:head_pipeline). + and_return(pipeline) allow(service).to receive(:todo_service).and_return(todo_service) end @@ -113,9 +113,9 @@ describe MergeRequests::AddTodoWhenBuildFailsService do it 'resolves todos about failed builds for pipeline' do service.close_all(pipeline) - expect(todo_service) - .to have_received(:merge_request_build_retried) - .with(merge_request) + expect(todo_service). + to have_received(:merge_request_build_retried). + with(merge_request) end end @@ -125,8 +125,8 @@ describe MergeRequests::AddTodoWhenBuildFailsService do it 'does not resolve any todos about failed builds' do service.close_all(pipeline) - expect(todo_service) - .not_to have_received(:merge_request_build_retried) + expect(todo_service). + not_to have_received(:merge_request_build_retried) end end end diff --git a/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb b/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb index f92978a33a3..65c08ce15f7 100644 --- a/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb +++ b/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb @@ -27,9 +27,9 @@ describe MergeRequests::MergeWhenPipelineSucceedsService do context 'first time enabling' do before do - allow(merge_request) - .to receive(:head_pipeline) - .and_return(pipeline) + allow(merge_request). + to receive(:head_pipeline). + and_return(pipeline) service.execute(merge_request) end @@ -52,11 +52,11 @@ describe MergeRequests::MergeWhenPipelineSucceedsService do let(:build) { create(:ci_build, ref: mr_merge_if_green_enabled.source_branch) } before do - allow(mr_merge_if_green_enabled).to receive(:head_pipeline) - .and_return(pipeline) + allow(mr_merge_if_green_enabled).to receive(:head_pipeline). + and_return(pipeline) - allow(mr_merge_if_green_enabled).to receive(:mergeable?) - .and_return(true) + allow(mr_merge_if_green_enabled).to receive(:mergeable?). + and_return(true) allow(pipeline).to receive(:success?).and_return(true) end @@ -152,9 +152,9 @@ describe MergeRequests::MergeWhenPipelineSucceedsService do before do # This behavior of MergeRequest: we instantiate a new object # - allow_any_instance_of(MergeRequest) - .to receive(:head_pipeline) - .and_wrap_original do + allow_any_instance_of(MergeRequest). + to receive(:head_pipeline). + and_wrap_original do Ci::Pipeline.find(pipeline.id) end end diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb index 9f24cc0f3f2..6dfcb702510 100644 --- a/spec/services/todo_service_spec.rb +++ b/spec/services/todo_service_spec.rb @@ -768,15 +768,15 @@ describe TodoService, services: true do create(:todo, :mentioned, user: john_doe, target: issue, project: project) todos = TodosFinder.new(john_doe, {}).execute - expect { TodoService.new.mark_todos_as_done(todos, john_doe) } - .to change { john_doe.todos.done.count }.from(0).to(1) + expect { TodoService.new.mark_todos_as_done(todos, john_doe) }. + to change { john_doe.todos.done.count }.from(0).to(1) end it 'marks an array of todos as done' do todo = create(:todo, :mentioned, user: john_doe, target: issue, project: project) - expect { TodoService.new.mark_todos_as_done([todo], john_doe) } - .to change { todo.reload.state }.from('pending').to('done') + expect { TodoService.new.mark_todos_as_done([todo], john_doe) }. + to change { todo.reload.state }.from('pending').to('done') end it 'returns the number of updated todos' do # Needed on API diff --git a/spec/support/ldap_helpers.rb b/spec/support/ldap_helpers.rb index 079f244475c..ab635711cf7 100644 --- a/spec/support/ldap_helpers.rb +++ b/spec/support/ldap_helpers.rb @@ -16,8 +16,8 @@ module LdapHelpers # ) def stub_ldap_config(messages) messages.each do |config, value| - allow_any_instance_of(::Gitlab::LDAP::Config) - .to receive(config.to_sym).and_return(value) + allow_any_instance_of(::Gitlab::LDAP::Config). + to receive(config.to_sym).and_return(value) end end @@ -32,8 +32,8 @@ module LdapHelpers def stub_ldap_person_find_by_uid(uid, entry, provider = 'ldapmain') return_value = ::Gitlab::LDAP::Person.new(entry, provider) if entry.present? - allow(::Gitlab::LDAP::Person) - .to receive(:find_by_uid).with(uid, any_args).and_return(return_value) + allow(::Gitlab::LDAP::Person). + to receive(:find_by_uid).with(uid, any_args).and_return(return_value) end # Create a simple LDAP user entry. diff --git a/spec/tasks/gitlab/check_rake_spec.rb b/spec/tasks/gitlab/check_rake_spec.rb index 538ff952bf4..a808ef7dcc0 100644 --- a/spec/tasks/gitlab/check_rake_spec.rb +++ b/spec/tasks/gitlab/check_rake_spec.rb @@ -23,8 +23,8 @@ describe 'gitlab:ldap:check rake task' do let(:adapter) { ldap_adapter('ldapmain', ldap) } before do - allow(Gitlab::LDAP::Config) - .to receive_messages( + allow(Gitlab::LDAP::Config). + to receive_messages( enabled?: true, providers: ['ldapmain'] ) diff --git a/spec/tasks/gitlab/shell_rake_spec.rb b/spec/tasks/gitlab/shell_rake_spec.rb index 226d34fe2c9..0787894ad2c 100644 --- a/spec/tasks/gitlab/shell_rake_spec.rb +++ b/spec/tasks/gitlab/shell_rake_spec.rb @@ -17,8 +17,8 @@ describe 'gitlab:shell rake tasks' do describe 'create_hooks task' do it 'calls gitlab-shell bin/create_hooks' do - expect_any_instance_of(Object).to receive(:system) - .with("#{Gitlab.config.gitlab_shell.path}/bin/create-hooks", *repository_storage_paths_args) + expect_any_instance_of(Object).to receive(:system). + with("#{Gitlab.config.gitlab_shell.path}/bin/create-hooks", *repository_storage_paths_args) run_rake_task('gitlab:shell:create_hooks') end diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb index 8020faa1f9c..254672a5612 100644 --- a/spec/views/layouts/_head.html.haml_spec.rb +++ b/spec/views/layouts/_head.html.haml_spec.rb @@ -26,7 +26,7 @@ describe 'layouts/_head' do end def stub_helper_with_safe_string(method) - allow_any_instance_of(PageLayoutHelper).to receive(method) - .and_return(%q{foo" http-equiv="refresh}.html_safe) + allow_any_instance_of(PageLayoutHelper).to receive(method). + and_return(%q{foo" http-equiv="refresh}.html_safe) end end diff --git a/spec/views/projects/merge_requests/edit.html.haml_spec.rb b/spec/views/projects/merge_requests/edit.html.haml_spec.rb index 3650b22c389..2e4390d6797 100644 --- a/spec/views/projects/merge_requests/edit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/edit.html.haml_spec.rb @@ -23,8 +23,8 @@ describe 'projects/merge_requests/edit.html.haml' do assign(:merge_request, closed_merge_request) allow(view).to receive(:can?).and_return(true) - allow(view).to receive(:current_user) - .and_return(User.find(closed_merge_request.author_id)) + allow(view).to receive(:current_user). + and_return(User.find(closed_merge_request.author_id)) end context 'when a merge request without fork' do diff --git a/spec/workers/build_coverage_worker_spec.rb b/spec/workers/build_coverage_worker_spec.rb index ba20488f663..8ebf00374a1 100644 --- a/spec/workers/build_coverage_worker_spec.rb +++ b/spec/workers/build_coverage_worker_spec.rb @@ -6,8 +6,8 @@ describe BuildCoverageWorker do let!(:build) { create(:ci_build) } it 'updates code coverage' do - expect_any_instance_of(Ci::Build) - .to receive(:update_coverage) + expect_any_instance_of(Ci::Build). + to receive(:update_coverage) described_class.new.perform(build.id) end @@ -15,8 +15,8 @@ describe BuildCoverageWorker do context 'when build does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/build_finished_worker_spec.rb b/spec/workers/build_finished_worker_spec.rb index 2868167c7d4..f8119913116 100644 --- a/spec/workers/build_finished_worker_spec.rb +++ b/spec/workers/build_finished_worker_spec.rb @@ -6,15 +6,15 @@ describe BuildFinishedWorker do let(:build) { create(:ci_build) } it 'calculates coverage and calls hooks' do - expect(BuildCoverageWorker) - .to receive(:new).ordered.and_call_original - expect(BuildHooksWorker) - .to receive(:new).ordered.and_call_original + expect(BuildCoverageWorker). + to receive(:new).ordered.and_call_original + expect(BuildHooksWorker). + to receive(:new).ordered.and_call_original - expect_any_instance_of(BuildCoverageWorker) - .to receive(:perform) - expect_any_instance_of(BuildHooksWorker) - .to receive(:perform) + expect_any_instance_of(BuildCoverageWorker). + to receive(:perform) + expect_any_instance_of(BuildHooksWorker). + to receive(:perform) described_class.new.perform(build.id) end @@ -22,8 +22,8 @@ describe BuildFinishedWorker do context 'when build does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/build_hooks_worker_spec.rb b/spec/workers/build_hooks_worker_spec.rb index 97654a93f5c..51abc1d89a1 100644 --- a/spec/workers/build_hooks_worker_spec.rb +++ b/spec/workers/build_hooks_worker_spec.rb @@ -6,8 +6,8 @@ describe BuildHooksWorker do let!(:build) { create(:ci_build) } it 'calls build hooks' do - expect_any_instance_of(Ci::Build) - .to receive(:execute_hooks) + expect_any_instance_of(Ci::Build). + to receive(:execute_hooks) described_class.new.perform(build.id) end @@ -15,8 +15,8 @@ describe BuildHooksWorker do context 'when build does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/build_success_worker_spec.rb b/spec/workers/build_success_worker_spec.rb index dba70883130..d016ecbb738 100644 --- a/spec/workers/build_success_worker_spec.rb +++ b/spec/workers/build_success_worker_spec.rb @@ -7,8 +7,8 @@ describe BuildSuccessWorker do let!(:build) { create(:ci_build, environment: 'production') } it 'executes deployment service' do - expect_any_instance_of(CreateDeploymentService) - .to receive(:execute) + expect_any_instance_of(CreateDeploymentService). + to receive(:execute) described_class.new.perform(build.id) end @@ -18,8 +18,8 @@ describe BuildSuccessWorker do let!(:build) { create(:ci_build, project: nil) } it 'does not create deployment' do - expect_any_instance_of(CreateDeploymentService) - .not_to receive(:execute) + expect_any_instance_of(CreateDeploymentService). + not_to receive(:execute) described_class.new.perform(build.id) end @@ -28,8 +28,8 @@ describe BuildSuccessWorker do context 'when build does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/pipeline_hooks_worker_spec.rb b/spec/workers/pipeline_hooks_worker_spec.rb index 035e329839f..061f4bda36c 100644 --- a/spec/workers/pipeline_hooks_worker_spec.rb +++ b/spec/workers/pipeline_hooks_worker_spec.rb @@ -6,8 +6,8 @@ describe PipelineHooksWorker do let(:pipeline) { create(:ci_pipeline) } it 'executes hooks for the pipeline' do - expect_any_instance_of(Ci::Pipeline) - .to receive(:execute_hooks) + expect_any_instance_of(Ci::Pipeline). + to receive(:execute_hooks) described_class.new.perform(pipeline.id) end @@ -15,8 +15,8 @@ describe PipelineHooksWorker do context 'when pipeline does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/pipeline_proccess_worker_spec.rb b/spec/workers/pipeline_proccess_worker_spec.rb index 86e9d7f6684..fd6ee0714ea 100644 --- a/spec/workers/pipeline_proccess_worker_spec.rb +++ b/spec/workers/pipeline_proccess_worker_spec.rb @@ -14,8 +14,8 @@ describe PipelineProcessWorker do context 'when pipeline does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/pipeline_success_worker_spec.rb b/spec/workers/pipeline_success_worker_spec.rb index d1c84adda6f..f6c56465feb 100644 --- a/spec/workers/pipeline_success_worker_spec.rb +++ b/spec/workers/pipeline_success_worker_spec.rb @@ -16,8 +16,8 @@ describe PipelineSuccessWorker do context 'when pipeline does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/pipeline_update_worker_spec.rb b/spec/workers/pipeline_update_worker_spec.rb index 0b456cfd0da..24d78aae112 100644 --- a/spec/workers/pipeline_update_worker_spec.rb +++ b/spec/workers/pipeline_update_worker_spec.rb @@ -14,8 +14,8 @@ describe PipelineUpdateWorker do context 'when pipeline does not exist' do it 'does not raise exception' do - expect { described_class.new.perform(123) } - .not_to raise_error + expect { described_class.new.perform(123) }. + not_to raise_error end end end diff --git a/spec/workers/project_cache_worker_spec.rb b/spec/workers/project_cache_worker_spec.rb index f4f63b57a5f..0fc274f1a01 100644 --- a/spec/workers/project_cache_worker_spec.rb +++ b/spec/workers/project_cache_worker_spec.rb @@ -31,9 +31,9 @@ describe ProjectCacheWorker do context 'with an existing project' do it 'updates the project statistics' do - expect(worker).to receive(:update_statistics) - .with(kind_of(Project), %i(repository_size)) - .and_call_original + expect(worker).to receive(:update_statistics). + with(kind_of(Project), %i(repository_size)). + and_call_original worker.perform(project.id, [], %w(repository_size)) end @@ -67,9 +67,9 @@ describe ProjectCacheWorker do with(project.id, :update_statistics). and_return(true) - expect(statistics).to receive(:refresh!) - .with(only: %i(repository_size)) - .and_call_original + expect(statistics).to receive(:refresh!). + with(only: %i(repository_size)). + and_call_original worker.update_statistics(project, %i(repository_size)) end diff --git a/spec/workers/use_key_worker_spec.rb b/spec/workers/use_key_worker_spec.rb index e50c788b82a..f8752c42a49 100644 --- a/spec/workers/use_key_worker_spec.rb +++ b/spec/workers/use_key_worker_spec.rb @@ -8,8 +8,8 @@ describe UseKeyWorker do current_time = Time.zone.now Timecop.freeze(current_time) do - expect { worker.perform(key.id) } - .to change { key.reload.last_used_at }.from(nil).to be_like_time(current_time) + expect { worker.perform(key.id) }. + to change { key.reload.last_used_at }.from(nil).to be_like_time(current_time) end end |