diff options
author | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
commit | 62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch) | |
tree | c3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /spec/views | |
parent | f6453eca992a9c142268e78ac782cef98110d183 (diff) | |
download | gitlab-ce-tc-standard-gem.tar.gz |
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I
decided to try https://github.com/testdouble/standard on our codebase.
It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'spec/views')
57 files changed, 821 insertions, 820 deletions
diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb index 0e8b7c82d3a..a59392aad8a 100644 --- a/spec/views/admin/dashboard/index.html.haml_spec.rb +++ b/spec/views/admin/dashboard/index.html.haml_spec.rb @@ -1,12 +1,12 @@ -require 'spec_helper' +require "spec_helper" -describe 'admin/dashboard/index.html.haml' do +describe "admin/dashboard/index.html.haml" do include Devise::Test::ControllerHelpers before do - counts = Admin::DashboardController::COUNTED_ITEMS.each_with_object({}) do |item, hash| + counts = Admin::DashboardController::COUNTED_ITEMS.each_with_object({}) { |item, hash| hash[item] = 100 - end + } assign(:counts, counts) assign(:projects, create_list(:project, 1)) @@ -20,7 +20,7 @@ describe 'admin/dashboard/index.html.haml' do it "shows version of GitLab Workhorse" do render - expect(rendered).to have_content 'GitLab Workhorse' + expect(rendered).to have_content "GitLab Workhorse" expect(rendered).to have_content Gitlab::Workhorse.version end diff --git a/spec/views/ci/status/_badge.html.haml_spec.rb b/spec/views/ci/status/_badge.html.haml_spec.rb index 49f57969239..63b0515c8cf 100644 --- a/spec/views/ci/status/_badge.html.haml_spec.rb +++ b/spec/views/ci/status/_badge.html.haml_spec.rb @@ -1,88 +1,88 @@ -require 'spec_helper' +require "spec_helper" -describe 'ci/status/_badge' do +describe "ci/status/_badge" do let(:user) { create(:user) } let(:project) { create(:project, :private) } let(:pipeline) { create(:ci_pipeline, project: project) } - context 'when rendering status for build' do + context "when rendering status for build" do let(:build) do create(:ci_build, :success, pipeline: pipeline) end - context 'when user has ability to see details' do + context "when user has ability to see details" do before do project.add_developer(user) end - it 'has link to build details page' do + it "has link to build details page" do details_path = project_job_path(project, build) render_status(build) - expect(rendered).to have_link 'passed', href: details_path + expect(rendered).to have_link "passed", href: details_path end end - context 'when user do not have ability to see build details' do + context "when user do not have ability to see build details" do before do render_status(build) end - it 'contains build status text' do - expect(rendered).to have_content 'passed' + it "contains build status text" do + expect(rendered).to have_content "passed" end - it 'does not contain links' do - expect(rendered).not_to have_link 'passed' + it "does not contain links" do + expect(rendered).not_to have_link "passed" end end end - context 'when rendering status for external job' do - context 'when user has ability to see commit status details' do + context "when rendering status for external job" do + context "when user has ability to see commit status details" do before do project.add_developer(user) end - context 'status has external target url' do + context "status has external target url" do before do external_job = create(:generic_commit_status, - status: :running, - pipeline: pipeline, - target_url: 'http://gitlab.com') + status: :running, + pipeline: pipeline, + target_url: "http://gitlab.com") render_status(external_job) end - it 'contains valid commit status text' do - expect(rendered).to have_content 'running' + it "contains valid commit status text" do + expect(rendered).to have_content "running" end - it 'has link to external status page' do - expect(rendered).to have_link 'running', href: 'http://gitlab.com' + it "has link to external status page" do + expect(rendered).to have_link "running", href: "http://gitlab.com" end end - context 'status do not have external target url' do + context "status do not have external target url" do before do external_job = create(:generic_commit_status, status: :canceled) render_status(external_job) end - it 'contains valid commit status text' do - expect(rendered).to have_content 'canceled' + it "contains valid commit status text" do + expect(rendered).to have_content "canceled" end - it 'has link to external status page' do - expect(rendered).not_to have_link 'canceled' + it "has link to external status page" do + expect(rendered).not_to have_link "canceled" end end end end def render_status(resource) - render 'ci/status/badge', status: resource.detailed_status(user) + render "ci/status/badge", status: resource.detailed_status(user) end end diff --git a/spec/views/dashboard/projects/_blank_state_admin_welcome.haml.rb b/spec/views/dashboard/projects/_blank_state_admin_welcome.haml.rb index 2f58eec86dc..4a8d9e07b64 100644 --- a/spec/views/dashboard/projects/_blank_state_admin_welcome.haml.rb +++ b/spec/views/dashboard/projects/_blank_state_admin_welcome.haml.rb @@ -1,15 +1,15 @@ -require 'spec_helper' +require "spec_helper" -describe 'dashboard/projects/_blank_state_admin_welcome.html.haml' do +describe "dashboard/projects/_blank_state_admin_welcome.html.haml" do let(:user) { create(:admin) } before do allow(view).to receive(:current_user).and_return(user) end - it 'links to new group path' do + it "links to new group path" do render - expect(rendered).to have_link('Create a group', href: new_group_path) + expect(rendered).to have_link("Create a group", href: new_group_path) end end diff --git a/spec/views/dashboard/projects/_nav.html.haml.rb b/spec/views/dashboard/projects/_nav.html.haml.rb index f6a8ca13040..67680e56317 100644 --- a/spec/views/dashboard/projects/_nav.html.haml.rb +++ b/spec/views/dashboard/projects/_nav.html.haml.rb @@ -1,17 +1,17 @@ -require 'spec_helper' +require "spec_helper" -describe 'dashboard/projects/_nav.html.haml' do - it 'highlights All tab by default' do +describe "dashboard/projects/_nav.html.haml" do + it "highlights All tab by default" do render - expect(rendered).to have_css('li.active a', text: 'All') + expect(rendered).to have_css("li.active a", text: "All") end - it 'highlights Personal tab personal param is present' do + it "highlights Personal tab personal param is present" do controller.params[:personal] = true render - expect(rendered).to have_css('li.active a', text: 'Personal') + expect(rendered).to have_css("li.active a", text: "Personal") end end diff --git a/spec/views/devise/shared/_signin_box.html.haml_spec.rb b/spec/views/devise/shared/_signin_box.html.haml_spec.rb index 66c064e3fba..7560036fd5b 100644 --- a/spec/views/devise/shared/_signin_box.html.haml_spec.rb +++ b/spec/views/devise/shared/_signin_box.html.haml_spec.rb @@ -1,7 +1,7 @@ -require 'rails_helper' +require "rails_helper" -describe 'devise/shared/_signin_box' do - describe 'Crowd form' do +describe "devise/shared/_signin_box" do + describe "Crowd form" do before do stub_devise assign(:ldap_servers, []) @@ -9,18 +9,18 @@ describe 'devise/shared/_signin_box' do allow(view).to receive(:captcha_enabled?).and_return(false) end - it 'is shown when Crowd is enabled' do + it "is shown when Crowd is enabled" do enable_crowd render - expect(rendered).to have_selector('#crowd form') + expect(rendered).to have_selector("#crowd form") end - it 'is not shown when Crowd is disabled' do + it "is not shown when Crowd is disabled" do render - expect(rendered).not_to have_selector('#crowd') + expect(rendered).not_to have_selector("#crowd") end end @@ -34,6 +34,6 @@ describe 'devise/shared/_signin_box' do allow(view).to receive(:form_based_providers).and_return([:crowd]) allow(view).to receive(:crowd_enabled?).and_return(true) allow(view).to receive(:omniauth_authorize_path).with(:user, :crowd) - .and_return('/crowd') + .and_return("/crowd") end end diff --git a/spec/views/errors/access_denied.html.haml_spec.rb b/spec/views/errors/access_denied.html.haml_spec.rb index bde2f6f0169..a907b9fb8ee 100644 --- a/spec/views/errors/access_denied.html.haml_spec.rb +++ b/spec/views/errors/access_denied.html.haml_spec.rb @@ -1,7 +1,7 @@ -require 'spec_helper' +require "spec_helper" -describe 'errors/access_denied' do - it 'does not fail to render when there is no message provided' do +describe "errors/access_denied" do + it "does not fail to render when there is no message provided" do expect { render }.not_to raise_error end end diff --git a/spec/views/events/event/_push.html.haml_spec.rb b/spec/views/events/event/_push.html.haml_spec.rb index f5634de4916..8420b59ead3 100644 --- a/spec/views/events/event/_push.html.haml_spec.rb +++ b/spec/views/events/event/_push.html.haml_spec.rb @@ -1,52 +1,52 @@ -require 'spec_helper' +require "spec_helper" -describe 'events/event/_push.html.haml' do +describe "events/event/_push.html.haml" do let(:event) { build_stubbed(:push_event) } - context 'with a branch' do + context "with a branch" do let(:payload) { build_stubbed(:push_event_payload, event: event) } before do allow(event).to receive(:push_event_payload).and_return(payload) end - it 'links to the branch' do + it "links to the branch" do allow(event.project.repository).to receive(:branch_exists?).with(event.ref_name).and_return(true) link = project_commits_path(event.project, event.ref_name) - render partial: 'events/event/push', locals: { event: event } + render partial: "events/event/push", locals: {event: event} expect(rendered).to have_link(event.ref_name, href: link) end - context 'that has been deleted' do - it 'does not link to the branch' do - render partial: 'events/event/push', locals: { event: event } + context "that has been deleted" do + it "does not link to the branch" do + render partial: "events/event/push", locals: {event: event} expect(rendered).not_to have_link(event.ref_name) end end end - context 'with a tag' do - let(:payload) { build_stubbed(:push_event_payload, event: event, ref_type: :tag, ref: 'v0.1.0') } + context "with a tag" do + let(:payload) { build_stubbed(:push_event_payload, event: event, ref_type: :tag, ref: "v0.1.0") } before do allow(event).to receive(:push_event_payload).and_return(payload) end - it 'links to the tag' do + it "links to the tag" do allow(event.project.repository).to receive(:tag_exists?).with(event.ref_name).and_return(true) link = project_commits_path(event.project, event.ref_name) - render partial: 'events/event/push', locals: { event: event } + render partial: "events/event/push", locals: {event: event} expect(rendered).to have_link(event.ref_name, href: link) end - context 'that has been deleted' do - it 'does not link to the tag' do - render partial: 'events/event/push', locals: { event: event } + context "that has been deleted" do + it "does not link to the tag" do + render partial: "events/event/push", locals: {event: event} expect(rendered).not_to have_link(event.ref_name) end diff --git a/spec/views/groups/edit.html.haml_spec.rb b/spec/views/groups/edit.html.haml_spec.rb index 38cfb84f0d5..8427c9d8d1c 100644 --- a/spec/views/groups/edit.html.haml_spec.rb +++ b/spec/views/groups/edit.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'groups/edit.html.haml' do +describe "groups/edit.html.haml" do include Devise::Test::ControllerHelpers describe '"Share with group lock" setting' do @@ -12,46 +12,46 @@ describe 'groups/edit.html.haml' do end shared_examples_for '"Share with group lock" setting' do |checkbox_options| - it 'should have the correct label, help text, and checkbox options' do + it "should have the correct label, help text, and checkbox options" do assign(:group, test_group) allow(view).to receive(:can?).with(test_user, :admin_group, test_group).and_return(true) allow(view).to receive(:can_change_group_visibility_level?).and_return(false) allow(view).to receive(:current_user).and_return(test_user) expect(view).to receive(:can_change_share_with_group_lock?).and_return(!checkbox_options[:disabled]) - expect(view).to receive(:share_with_group_lock_help_text).and_return('help text here') + expect(view).to receive(:share_with_group_lock_help_text).and_return("help text here") render expect(rendered).to have_content("Prevent sharing a project within #{test_group.name} with other groups") - expect(rendered).to have_css('.descr', text: 'help text here') - expect(rendered).to have_field('group_share_with_group_lock', checkbox_options) + expect(rendered).to have_css(".descr", text: "help text here") + expect(rendered).to have_field("group_share_with_group_lock", checkbox_options) end end - context 'for a root group' do + context "for a root group" do let(:test_group) { root_group } let(:test_user) { root_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: false} end - context 'for a subgroup', :nested_groups do + context "for a subgroup", :nested_groups do let!(:subgroup) { create(:group, parent: root_group) } let(:sub_owner) { create(:user) } let(:test_group) { subgroup } context 'when the root_group has "Share with group lock" disabled' do context 'when the subgroup has "Share with group lock" disabled' do - context 'as the root_owner' do + context "as the root_owner" do let(:test_user) { root_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: false} end - context 'as the sub_owner' do + context "as the sub_owner" do let(:test_user) { sub_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: false} end end @@ -60,16 +60,16 @@ describe 'groups/edit.html.haml' do subgroup.update_column(:share_with_group_lock, true) end - context 'as the root_owner' do + context "as the root_owner" do let(:test_user) { root_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: true } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: true} end - context 'as the sub_owner' do + context "as the sub_owner" do let(:test_user) { sub_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: true } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: true} end end end @@ -80,16 +80,16 @@ describe 'groups/edit.html.haml' do end context 'when the subgroup has "Share with group lock" disabled (parent overridden)' do - context 'as the root_owner' do + context "as the root_owner" do let(:test_user) { root_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: false} end - context 'as the sub_owner' do + context "as the sub_owner" do let(:test_user) { sub_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: false } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: false} end end @@ -98,16 +98,16 @@ describe 'groups/edit.html.haml' do subgroup.update_column(:share_with_group_lock, true) end - context 'as the root_owner' do + context "as the root_owner" do let(:test_user) { root_owner } - it_behaves_like '"Share with group lock" setting', { disabled: false, checked: true } + it_behaves_like '"Share with group lock" setting', {disabled: false, checked: true} end - context 'as the sub_owner' do + context "as the sub_owner" do let(:test_user) { sub_owner } - it_behaves_like '"Share with group lock" setting', { disabled: true, checked: true } + it_behaves_like '"Share with group lock" setting', {disabled: true, checked: true} end end end diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index 34e93d929a7..06ef459a4fb 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -1,52 +1,52 @@ # frozen_string_literal: true -require 'rails_helper' +require "rails_helper" -describe 'help/index' do +describe "help/index" do include StubVersion - describe 'version information' do + describe "version information" do before do stub_helpers end - it 'is hidden from guests' do + it "is hidden from guests" do stub_user(nil) - stub_version('8.0.2', 'abcdefg') + stub_version("8.0.2", "abcdefg") render - expect(rendered).not_to match '8.0.2' - expect(rendered).not_to match 'abcdefg' + expect(rendered).not_to match "8.0.2" + expect(rendered).not_to match "abcdefg" end - context 'when logged in' do + context "when logged in" do before do stub_user end - it 'shows a link to the tag to users' do - stub_version('8.0.2', 'abcdefg') + it "shows a link to the tag to users" do + stub_version("8.0.2", "abcdefg") render - expect(rendered).to match '8.0.2' - expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/tags/v8.0.2}) + expect(rendered).to match "8.0.2" + expect(rendered).to have_link("8.0.2", href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/tags/v8.0.2}) end - it 'shows a link to the commit for pre-releases' do - stub_version('8.0.2-pre', 'abcdefg') + it "shows a link to the commit for pre-releases" do + stub_version("8.0.2-pre", "abcdefg") render - expect(rendered).to match '8.0.2' - expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/commits/abcdefg}) + expect(rendered).to match "8.0.2" + expect(rendered).to have_link("abcdefg", href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/commits/abcdefg}) end end end - describe 'instance configuration link' do - it 'is visible to guests' do + describe "instance configuration link" do + it "is visible to guests" do render expect(rendered).to have_link(nil, href: help_instance_configuration_url) @@ -58,8 +58,8 @@ describe 'help/index' do end def stub_helpers - allow(view).to receive(:markdown).and_return('') - allow(view).to receive(:version_status_badge).and_return('') + allow(view).to receive(:markdown).and_return("") + allow(view).to receive(:version_status_badge).and_return("") allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) end end diff --git a/spec/views/help/instance_configuration.html.haml_spec.rb b/spec/views/help/instance_configuration.html.haml_spec.rb index ceb7e34a540..a34f0aaefd5 100644 --- a/spec/views/help/instance_configuration.html.haml_spec.rb +++ b/spec/views/help/instance_configuration.html.haml_spec.rb @@ -1,7 +1,7 @@ -require 'rails_helper' +require "rails_helper" -describe 'help/instance_configuration' do - describe 'General Sections:' do +describe "help/instance_configuration" do + describe "General Sections:" do let(:instance_configuration) { build(:instance_configuration)} let(:settings) { instance_configuration.settings } let(:ssh_settings) { settings[:ssh_algorithms_hashes] } @@ -10,20 +10,20 @@ describe 'help/instance_configuration' do assign(:instance_configuration, instance_configuration) end - it 'has links to several sections' do + it "has links to several sections" do render - expect(rendered).to have_link(nil, href: '#ssh-host-keys-fingerprints') if ssh_settings.any? - expect(rendered).to have_link(nil, href: '#gitlab-pages') - expect(rendered).to have_link(nil, href: '#gitlab-ci') + expect(rendered).to have_link(nil, href: "#ssh-host-keys-fingerprints") if ssh_settings.any? + expect(rendered).to have_link(nil, href: "#gitlab-pages") + expect(rendered).to have_link(nil, href: "#gitlab-ci") end - it 'has several sections' do + it "has several sections" do render - expect(rendered).to have_css('h2#ssh-host-keys-fingerprints') if ssh_settings.any? - expect(rendered).to have_css('h2#gitlab-pages') - expect(rendered).to have_css('h2#gitlab-ci') + expect(rendered).to have_css("h2#ssh-host-keys-fingerprints") if ssh_settings.any? + expect(rendered).to have_css("h2#gitlab-pages") + expect(rendered).to have_css("h2#gitlab-ci") end end end diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb index cbb4199954a..2987c1e1124 100644 --- a/spec/views/layouts/_head.html.haml_spec.rb +++ b/spec/views/layouts/_head.html.haml_spec.rb @@ -1,68 +1,68 @@ -require 'spec_helper' +require "spec_helper" -describe 'layouts/_head' do +describe "layouts/_head" do before do allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) end - it 'escapes HTML-safe strings in page_title' do + it "escapes HTML-safe strings in page_title" do stub_helper_with_safe_string(:page_title) render - expect(rendered).to match(%{content="foo" http-equiv="refresh"}) + expect(rendered).to match(%(content="foo" http-equiv="refresh")) end - it 'escapes HTML-safe strings in page_description' do + it "escapes HTML-safe strings in page_description" do stub_helper_with_safe_string(:page_description) render - expect(rendered).to match(%{content="foo" http-equiv="refresh"}) + expect(rendered).to match(%(content="foo" http-equiv="refresh")) end - it 'escapes HTML-safe strings in page_image' do + it "escapes HTML-safe strings in page_image" do stub_helper_with_safe_string(:page_image) render - expect(rendered).to match(%{content="foo" http-equiv="refresh"}) + expect(rendered).to match(%(content="foo" http-equiv="refresh")) end - context 'when an asset_host is set and feature is activated in the config it will' do - let(:asset_host) { 'http://assets' } + context "when an asset_host is set and feature is activated in the config it will" do + let(:asset_host) { "http://assets" } before do stub_feature_flags(asset_host_prefetch: true) allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) end - it 'add a link dns-prefetch tag' do + it "add a link dns-prefetch tag" do render expect(rendered).to match('<link href="http://assets" rel="dns-prefetch">') end - it 'add a link preconnect tag' do + it "add a link preconnect tag" do render expect(rendered).to match('<link crossorigin="" href="http://assets" rel="preconnnect">') end end - context 'when an asset_host is set and feature is not activated in the config it will' do - let(:asset_host) { 'http://assets' } + context "when an asset_host is set and feature is not activated in the config it will" do + let(:asset_host) { "http://assets" } before do stub_feature_flags(asset_host_prefetch: false) allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) end - it 'not add a link dns-prefetch tag' do + it "not add a link dns-prefetch tag" do render expect(rendered).not_to match('<link href="http://assets" rel="dns-prefetch">') end end - it 'adds selected syntax highlight stylesheet' do + it "adds selected syntax highlight stylesheet" do allow_any_instance_of(PreferencesHelper).to receive(:user_color_scheme).and_return("solarised-light") render @@ -72,6 +72,6 @@ describe 'layouts/_head' do def stub_helper_with_safe_string(method) allow_any_instance_of(PageLayoutHelper).to receive(method) - .and_return(%q{foo" http-equiv="refresh}.html_safe) + .and_return('foo" http-equiv="refresh'.html_safe) end end diff --git a/spec/views/layouts/header/_new_dropdown.haml_spec.rb b/spec/views/layouts/header/_new_dropdown.haml_spec.rb index 2e19d0cec26..27767a0ac3e 100644 --- a/spec/views/layouts/header/_new_dropdown.haml_spec.rb +++ b/spec/views/layouts/header/_new_dropdown.haml_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require 'spec_helper' +require "spec_helper" -describe 'layouts/header/_new_dropdown' do +describe "layouts/header/_new_dropdown" do let(:user) { create(:user) } - context 'group-specific links' do + context "group-specific links" do let(:group) { create(:group) } before do @@ -14,7 +14,7 @@ describe 'layouts/header/_new_dropdown' do assign(:group, group) end - context 'as a Group owner' do + context "as a Group owner" do before do group.add_owner(user) end @@ -23,7 +23,7 @@ describe 'layouts/header/_new_dropdown' do render expect(rendered).to have_link( - 'New project', + "New project", href: new_project_path(namespace_id: group.id) ) end @@ -32,21 +32,21 @@ describe 'layouts/header/_new_dropdown' do render expect(rendered).to have_link( - 'New subgroup', + "New subgroup", href: new_group_path(parent_id: group.id) ) end end end - context 'project-specific links' do + context "project-specific links" do let(:project) { create(:project, creator: user, namespace: user.namespace) } before do assign(:project, project) end - context 'as a Project owner' do + context "as a Project owner" do before do stub_current_user(user) end @@ -55,7 +55,7 @@ describe 'layouts/header/_new_dropdown' do render expect(rendered).to have_link( - 'New issue', + "New issue", href: new_project_issue_path(project) ) end @@ -64,7 +64,7 @@ describe 'layouts/header/_new_dropdown' do render expect(rendered).to have_link( - 'New merge request', + "New merge request", href: project_new_merge_request_path(project) ) end @@ -73,13 +73,13 @@ describe 'layouts/header/_new_dropdown' do render expect(rendered).to have_link( - 'New snippet', + "New snippet", href: new_project_snippet_path(project) ) end end - context 'as a Project guest' do + context "as a Project guest" do let(:guest) { create(:user) } before do @@ -90,21 +90,21 @@ describe 'layouts/header/_new_dropdown' do it 'has no "New merge request" link' do render - expect(rendered).not_to have_link('New merge request') + expect(rendered).not_to have_link("New merge request") end it 'has no "New snippet" link' do render expect(rendered).not_to have_link( - 'New snippet', + "New snippet", href: new_project_snippet_path(project) ) end end end - context 'global links' do + context "global links" do before do stub_current_user(user) end @@ -112,19 +112,19 @@ describe 'layouts/header/_new_dropdown' do it 'has a "New project" link' do render - expect(rendered).to have_link('New project', href: new_project_path) + expect(rendered).to have_link("New project", href: new_project_path) end it 'has a "New group" link' do render - expect(rendered).to have_link('New group', href: new_group_path) + expect(rendered).to have_link("New group", href: new_group_path) end it 'has a "New snippet" link' do render - expect(rendered).to have_link('New snippet', href: new_snippet_path) + expect(rendered).to have_link("New snippet", href: new_snippet_path) end end diff --git a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb index 05c2f61a606..0fe5131ee1c 100644 --- a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb @@ -1,90 +1,90 @@ -require 'spec_helper' +require "spec_helper" -describe 'layouts/nav/sidebar/_admin' do - shared_examples 'page has active tab' do |title| +describe "layouts/nav/sidebar/_admin" do + shared_examples "page has active tab" do |title| it "activates #{title} tab" do render - expect(rendered).to have_selector('.nav-sidebar .sidebar-top-level-items > li.active', count: 1) - expect(rendered).to have_css('.nav-sidebar .sidebar-top-level-items > li.active', text: title) + expect(rendered).to have_selector(".nav-sidebar .sidebar-top-level-items > li.active", count: 1) + expect(rendered).to have_css(".nav-sidebar .sidebar-top-level-items > li.active", text: title) end end - shared_examples 'page has active sub tab' do |title| + shared_examples "page has active sub tab" do |title| it "activates #{title} sub tab" do render - expect(rendered).to have_css('.sidebar-sub-level-items > li.active', text: title) + expect(rendered).to have_css(".sidebar-sub-level-items > li.active", text: title) end end - context 'on home page' do + context "on home page" do before do - allow(controller).to receive(:controller_name).and_return('dashboard') + allow(controller).to receive(:controller_name).and_return("dashboard") end - it_behaves_like 'page has active tab', 'Overview' + it_behaves_like "page has active tab", "Overview" end - context 'on projects' do + context "on projects" do before do - allow(controller).to receive(:controller_name).and_return('projects') - allow(controller).to receive(:controller_path).and_return('admin/projects') + allow(controller).to receive(:controller_name).and_return("projects") + allow(controller).to receive(:controller_path).and_return("admin/projects") end - it_behaves_like 'page has active tab', 'Overview' - it_behaves_like 'page has active sub tab', 'Projects' + it_behaves_like "page has active tab", "Overview" + it_behaves_like "page has active sub tab", "Projects" end - context 'on groups' do + context "on groups" do before do - allow(controller).to receive(:controller_name).and_return('groups') + allow(controller).to receive(:controller_name).and_return("groups") end - it_behaves_like 'page has active tab', 'Overview' - it_behaves_like 'page has active sub tab', 'Groups' + it_behaves_like "page has active tab", "Overview" + it_behaves_like "page has active sub tab", "Groups" end - context 'on users' do + context "on users" do before do - allow(controller).to receive(:controller_name).and_return('users') + allow(controller).to receive(:controller_name).and_return("users") end - it_behaves_like 'page has active tab', 'Overview' - it_behaves_like 'page has active sub tab', 'Users' + it_behaves_like "page has active tab", "Overview" + it_behaves_like "page has active sub tab", "Users" end - context 'on logs' do + context "on logs" do before do - allow(controller).to receive(:controller_name).and_return('logs') + allow(controller).to receive(:controller_name).and_return("logs") end - it_behaves_like 'page has active tab', 'Monitoring' - it_behaves_like 'page has active sub tab', 'Logs' + it_behaves_like "page has active tab", "Monitoring" + it_behaves_like "page has active sub tab", "Logs" end - context 'on messages' do + context "on messages" do before do - allow(controller).to receive(:controller_name).and_return('broadcast_messages') + allow(controller).to receive(:controller_name).and_return("broadcast_messages") end - it_behaves_like 'page has active tab', 'Messages' + it_behaves_like "page has active tab", "Messages" end - context 'on hooks' do + context "on hooks" do before do - allow(controller).to receive(:controller_name).and_return('hooks') + allow(controller).to receive(:controller_name).and_return("hooks") end - it_behaves_like 'page has active tab', 'Hooks' + it_behaves_like "page has active tab", "Hooks" end - context 'on background jobs' do + context "on background jobs" do before do - allow(controller).to receive(:controller_name).and_return('background_jobs') + allow(controller).to receive(:controller_name).and_return("background_jobs") end - it_behaves_like 'page has active tab', 'Monitoring' - it_behaves_like 'page has active sub tab', 'Background Jobs' + it_behaves_like "page has active tab", "Monitoring" + it_behaves_like "page has active sub tab", "Background Jobs" end end diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index d9f05e5f94f..9105437d602 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -1,91 +1,91 @@ -require 'spec_helper' +require "spec_helper" -describe 'layouts/nav/sidebar/_project' do +describe "layouts/nav/sidebar/_project" do let(:project) { create(:project, :repository) } before do assign(:project, project) assign(:repository, project.repository) - allow(view).to receive(:current_ref).and_return('master') + allow(view).to receive(:current_ref).and_return("master") allow(view).to receive(:can?).and_return(true) end - describe 'issue boards' do - it 'has board tab' do + describe "issue boards" do + it "has board tab" do render expect(rendered).to have_css('a[title="Board"]') end end - describe 'container registry tab' do + describe "container registry tab" do before do stub_container_registry_config(enabled: true) allow(controller).to receive(:controller_name) - .and_return('repositories') + .and_return("repositories") allow(controller).to receive(:controller_path) - .and_return('projects/registry/repositories') + .and_return("projects/registry/repositories") end - it 'has both Registry and Repository tabs' do + it "has both Registry and Repository tabs" do render - expect(rendered).to have_text 'Repository' - expect(rendered).to have_text 'Registry' + expect(rendered).to have_text "Repository" + expect(rendered).to have_text "Registry" end - it 'highlights sidebar item and flyout' do + it "highlights sidebar item and flyout" do render - expect(rendered).to have_css('.sidebar-top-level-items > li.active', count: 1) - expect(rendered).to have_css('.is-fly-out-only > li.active', count: 1) + expect(rendered).to have_css(".sidebar-top-level-items > li.active", count: 1) + expect(rendered).to have_css(".is-fly-out-only > li.active", count: 1) end - it 'highlights container registry tab' do + it "highlights container registry tab" do render - expect(rendered).to have_css('.sidebar-top-level-items > li.active', text: 'Registry') + expect(rendered).to have_css(".sidebar-top-level-items > li.active", text: "Registry") end end - describe 'releases entry' do - it 'renders releases link' do + describe "releases entry" do + it "renders releases link" do render - expect(rendered).to have_link('Releases', href: project_releases_path(project)) + expect(rendered).to have_link("Releases", href: project_releases_path(project)) end end - describe 'wiki entry tab' do + describe "wiki entry tab" do let(:can_read_wiki) { true } before do allow(view).to receive(:can?).with(nil, :read_wiki, project).and_return(can_read_wiki) end - describe 'when wiki is enabled' do - it 'shows the wiki tab with the wiki internal link' do + describe "when wiki is enabled" do + it "shows the wiki tab with the wiki internal link" do render - expect(rendered).to have_link('Wiki', href: project_wiki_path(project, :home)) + expect(rendered).to have_link("Wiki", href: project_wiki_path(project, :home)) end end - describe 'when wiki is disabled' do + describe "when wiki is disabled" do let(:can_read_wiki) { false } - it 'does not show the wiki tab' do + it "does not show the wiki tab" do render - expect(rendered).not_to have_link('Wiki', href: project_wiki_path(project, :home)) + expect(rendered).not_to have_link("Wiki", href: project_wiki_path(project, :home)) end end end - describe 'external wiki entry tab' do - let(:properties) { { 'external_wiki_url' => 'https://gitlab.com' } } + describe "external wiki entry tab" do + let(:properties) { {"external_wiki_url" => "https://gitlab.com"} } let(:service_status) { true } before do @@ -93,21 +93,21 @@ describe 'layouts/nav/sidebar/_project' do project.reload end - context 'when it is active' do - it 'shows the external wiki tab with the external wiki service link' do + context "when it is active" do + it "shows the external wiki tab with the external wiki service link" do render - expect(rendered).to have_link('External Wiki', href: properties['external_wiki_url']) + expect(rendered).to have_link("External Wiki", href: properties["external_wiki_url"]) end end - context 'when it is disabled' do + context "when it is disabled" do let(:service_status) { false } - it 'does not show the external wiki tab' do + it "does not show the external wiki tab" do render - expect(rendered).not_to have_link('External Wiki', href: project_wiki_path(project, :home)) + expect(rendered).not_to have_link("External Wiki", href: project_wiki_path(project, :home)) end end end diff --git a/spec/views/notify/changed_milestone_email.html.haml_spec.rb b/spec/views/notify/changed_milestone_email.html.haml_spec.rb index 194b58840a3..1867e0f7b5a 100644 --- a/spec/views/notify/changed_milestone_email.html.haml_spec.rb +++ b/spec/views/notify/changed_milestone_email.html.haml_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require 'spec_helper' +require "spec_helper" -describe 'notify/changed_milestone_email.html.haml' do - let(:milestone) { create(:milestone, title: 'some-milestone') } +describe "notify/changed_milestone_email.html.haml" do + let(:milestone) { create(:milestone, title: "some-milestone") } let(:milestone_link) { milestone_url(milestone) } before do @@ -11,25 +11,25 @@ describe 'notify/changed_milestone_email.html.haml' do assign(:milestone_url, milestone_link) end - context 'milestone without start and due dates' do - it 'renders without date range' do + context "milestone without start and due dates" do + it "renders without date range" do render - expect(rendered).to have_content('Milestone changed to some-milestone', exact: true) - expect(rendered).to have_link('some-milestone', href: milestone_link) + expect(rendered).to have_content("Milestone changed to some-milestone", exact: true) + expect(rendered).to have_link("some-milestone", href: milestone_link) end end - context 'milestone with start and due dates' do + context "milestone with start and due dates" do before do - milestone.update(start_date: '2018-01-01', due_date: '2018-12-31') + milestone.update(start_date: "2018-01-01", due_date: "2018-12-31") end - it 'renders with date range' do + it "renders with date range" do render - expect(rendered).to have_content('Milestone changed to some-milestone (Jan 1, 2018–Dec 31, 2018)', exact: true) - expect(rendered).to have_link('some-milestone', href: milestone_link) + expect(rendered).to have_content("Milestone changed to some-milestone (Jan 1, 2018–Dec 31, 2018)", exact: true) + expect(rendered).to have_link("some-milestone", href: milestone_link) end end end diff --git a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb index d9d73f789c5..3d0e8873125 100644 --- a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'notify/pipeline_failed_email.html.haml' do +describe "notify/pipeline_failed_email.html.haml" do include Devise::Test::ControllerHelpers let(:user) { create(:user) } @@ -9,11 +9,11 @@ describe 'notify/pipeline_failed_email.html.haml' do let(:pipeline) do create(:ci_pipeline, - project: project, - user: user, - ref: project.default_branch, - sha: project.commit.sha, - status: :success) + project: project, + user: user, + ref: project.default_branch, + sha: project.commit.sha, + status: :success) end before do @@ -22,8 +22,8 @@ describe 'notify/pipeline_failed_email.html.haml' do assign(:merge_request, merge_request) end - context 'pipeline with user' do - it 'renders the email correctly' do + context "pipeline with user" do + it "renders the email correctly" do render expect(rendered).to have_content "Your pipeline has failed" @@ -35,12 +35,12 @@ describe 'notify/pipeline_failed_email.html.haml' do end end - context 'pipeline without user' do + context "pipeline without user" do before do pipeline.update_attribute(:user, nil) end - it 'renders the email correctly' do + it "renders the email correctly" do render expect(rendered).to have_content "Your pipeline has failed" diff --git a/spec/views/notify/pipeline_success_email.html.haml_spec.rb b/spec/views/notify/pipeline_success_email.html.haml_spec.rb index a793b37e412..be5b8950d97 100644 --- a/spec/views/notify/pipeline_success_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_success_email.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'notify/pipeline_success_email.html.haml' do +describe "notify/pipeline_success_email.html.haml" do include Devise::Test::ControllerHelpers let(:user) { create(:user) } @@ -9,11 +9,11 @@ describe 'notify/pipeline_success_email.html.haml' do let(:pipeline) do create(:ci_pipeline, - project: project, - user: user, - ref: project.default_branch, - sha: project.commit.sha, - status: :success) + project: project, + user: user, + ref: project.default_branch, + sha: project.commit.sha, + status: :success) end before do @@ -22,8 +22,8 @@ describe 'notify/pipeline_success_email.html.haml' do assign(:merge_request, merge_request) end - context 'pipeline with user' do - it 'renders the email correctly' do + context "pipeline with user" do + it "renders the email correctly" do render expect(rendered).to have_content "Your pipeline has passed" @@ -35,12 +35,12 @@ describe 'notify/pipeline_success_email.html.haml' do end end - context 'pipeline without user' do + context "pipeline without user" do before do pipeline.update_attribute(:user, nil) end - it 'renders the email correctly' do + it "renders the email correctly" do render expect(rendered).to have_content "Your pipeline has passed" diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb index e89a8cb9626..f649c42faf8 100644 --- a/spec/views/profiles/show.html.haml_spec.rb +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'profiles/show' do +describe "profiles/show" do let(:user) { create(:user) } before do @@ -8,12 +8,12 @@ describe 'profiles/show' do allow(controller).to receive(:current_user).and_return(user) end - context 'when the profile page is opened' do - it 'displays the correct elements' do + context "when the profile page is opened" do + it "displays the correct elements" do render - expect(rendered).to have_field('user_name', user.name) - expect(rendered).to have_field('user_id', user.id) + expect(rendered).to have_field("user_name", user.name) + expect(rendered).to have_field("user_id", user.id) end end end diff --git a/spec/views/projects/_home_panel.html.haml_spec.rb b/spec/views/projects/_home_panel.html.haml_spec.rb index 908ecb898e4..51125ae2243 100644 --- a/spec/views/projects/_home_panel.html.haml_spec.rb +++ b/spec/views/projects/_home_panel.html.haml_spec.rb @@ -1,7 +1,7 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/_home_panel' do - context 'notifications' do +describe "projects/_home_panel" do + context "notifications" do let(:project) { create(:project) } before do @@ -12,7 +12,7 @@ describe 'projects/_home_panel' do allow(project).to receive(:license_anchor_data).and_return(false) end - context 'when user is signed in' do + context "when user is signed in" do let(:user) { create(:user) } before do @@ -20,35 +20,35 @@ describe 'projects/_home_panel' do assign(:notification_setting, notification_settings) end - it 'makes it possible to set notification level' do + it "makes it possible to set notification level" do render - expect(view).to render_template('shared/notifications/_new_button') - expect(rendered).to have_selector('.notification-dropdown') + expect(view).to render_template("shared/notifications/_new_button") + expect(rendered).to have_selector(".notification-dropdown") end end - context 'when user is signed out' do + context "when user is signed out" do let(:user) { nil } before do assign(:notification_setting, nil) end - it 'is not possible to set notification level' do + it "is not possible to set notification level" do render - expect(rendered).not_to have_selector('.notification_dropdown') + expect(rendered).not_to have_selector(".notification_dropdown") end end end - context 'badges' do - shared_examples 'show badges' do - it 'should render the all badges' do + context "badges" do + shared_examples "show badges" do + it "should render the all badges" do render - expect(rendered).to have_selector('.project-badges a') + expect(rendered).to have_selector(".project-badges a") badges.each do |badge| expect(rendered).to have_link(href: badge.rendered_link_url) @@ -67,17 +67,17 @@ describe 'projects/_home_panel' do allow(project).to receive(:license_anchor_data).and_return(false) end - context 'has no badges' do + context "has no badges" do let(:project) { create(:project) } - it 'should not render any badge' do + it "should not render any badge" do render - expect(rendered).not_to have_selector('.project-badges') + expect(rendered).not_to have_selector(".project-badges") end end - context 'only has group badges' do + context "only has group badges" do let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } @@ -85,20 +85,20 @@ describe 'projects/_home_panel' do create(:group_badge, group: project.group) end - it_behaves_like 'show badges' + it_behaves_like "show badges" end - context 'only has project badges' do + context "only has project badges" do let(:project) { create(:project) } before do create(:project_badge, project: project) end - it_behaves_like 'show badges' + it_behaves_like "show badges" end - context 'has both group and project badges' do + context "has both group and project badges" do let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } @@ -107,11 +107,11 @@ describe 'projects/_home_panel' do create(:group_badge, group: project.group) end - it_behaves_like 'show badges' + it_behaves_like "show badges" end end - context 'project id' do + context "project id" do let(:project) { create(:project) } let(:user) { create(:user) } @@ -122,8 +122,8 @@ describe 'projects/_home_panel' do allow(project).to receive(:license_anchor_data).and_return(false) end - context 'user can read project' do - it 'is shown' do + context "user can read project" do + it "is shown" do allow(view).to receive(:can?).with(user, :read_project, project).and_return(true) render @@ -132,8 +132,8 @@ describe 'projects/_home_panel' do end end - context 'user cannot read project' do - it 'is not shown' do + context "user cannot read project" do + it "is not shown" do allow(view).to receive(:can?).with(user, :read_project, project).and_return(false) render diff --git a/spec/views/projects/blob/_viewer.html.haml_spec.rb b/spec/views/projects/blob/_viewer.html.haml_spec.rb index 95f7f87d37b..a07c14460b4 100644 --- a/spec/views/projects/blob/_viewer.html.haml_spec.rb +++ b/spec/views/projects/blob/_viewer.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/blob/_viewer.html.haml' do +describe "projects/blob/_viewer.html.haml" do include FakeBlobHelpers let(:project) { build(:project) } @@ -9,7 +9,7 @@ describe 'projects/blob/_viewer.html.haml' do Class.new(BlobViewer::Base) do include BlobViewer::Rich - self.partial_name = 'text' + self.partial_name = "text" self.collapse_limit = 1.megabyte self.size_limit = 5.megabytes self.load_async = true @@ -22,77 +22,77 @@ describe 'projects/blob/_viewer.html.haml' do before do assign(:project, project) assign(:blob, blob) - assign(:id, File.join('master', blob.path)) + assign(:id, File.join("master", blob.path)) - controller.params[:controller] = 'projects/blob' - controller.params[:action] = 'show' + controller.params[:controller] = "projects/blob" + controller.params[:action] = "show" controller.params[:namespace_id] = project.namespace.to_param controller.params[:project_id] = project.to_param - controller.params[:id] = File.join('master', blob.path) + controller.params[:id] = File.join("master", blob.path) allow(project.repository).to receive(:gitattribute).and_return(nil) end def render_view - render partial: 'projects/blob/viewer', locals: { viewer: viewer } + render partial: "projects/blob/viewer", locals: {viewer: viewer} end - context 'when the viewer is loaded asynchronously' do + context "when the viewer is loaded asynchronously" do before do viewer_class.load_async = true end - context 'when there is no render error' do - it 'adds a URL to the blob viewer element' do + context "when there is no render error" do + it "adds a URL to the blob viewer element" do render_view - expect(rendered).to have_css('.blob-viewer[data-url]') + expect(rendered).to have_css(".blob-viewer[data-url]") end - it 'renders the loading indicator' do + it "renders the loading indicator" do render_view - expect(view).to render_template('projects/blob/viewers/_loading') + expect(view).to render_template("projects/blob/viewers/_loading") end end - context 'when there is a render error' do + context "when there is a render error" do let(:blob) { fake_blob(size: 10.megabytes) } - it 'renders the error' do + it "renders the error" do render_view - expect(view).to render_template('projects/blob/_render_error') + expect(view).to render_template("projects/blob/_render_error") end end end - context 'when the viewer is loaded synchronously' do + context "when the viewer is loaded synchronously" do before do viewer_class.load_async = false end - context 'when there is no render error' do - it 'prepares the viewer' do + context "when there is no render error" do + it "prepares the viewer" do expect(viewer).to receive(:prepare!) render_view end - it 'renders the viewer' do + it "renders the viewer" do render_view - expect(view).to render_template('projects/blob/viewers/_text') + expect(view).to render_template("projects/blob/viewers/_text") end end - context 'when there is a render error' do + context "when there is a render error" do let(:blob) { fake_blob(size: 10.megabytes) } - it 'renders the error' do + it "renders the error" do render_view - expect(view).to render_template('projects/blob/_render_error') + expect(view).to render_template("projects/blob/_render_error") end end end diff --git a/spec/views/projects/buttons/_dropdown.html.haml_spec.rb b/spec/views/projects/buttons/_dropdown.html.haml_spec.rb index 8b9aab30286..23d6e5d95c8 100644 --- a/spec/views/projects/buttons/_dropdown.html.haml_spec.rb +++ b/spec/views/projects/buttons/_dropdown.html.haml_spec.rb @@ -1,9 +1,9 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/buttons/_dropdown' do +describe "projects/buttons/_dropdown" do let(:user) { create(:user) } - context 'user with all abilities' do + context "user with all abilities" do before do assign(:project, project) @@ -12,28 +12,28 @@ describe 'projects/buttons/_dropdown' do allow(view).to receive(:can_collaborate_with_project?).and_return(true) end - context 'empty repository' do + context "empty repository" do let(:project) { create(:project, :empty_repo) } - it 'has a link to create a new file' do + it "has a link to create a new file" do render - expect(view).to render_template('projects/buttons/_dropdown') - expect(rendered).to have_link('New file') + expect(view).to render_template("projects/buttons/_dropdown") + expect(rendered).to have_link("New file") end - it 'does not have a link to create a new branch' do + it "does not have a link to create a new branch" do render - expect(view).to render_template('projects/buttons/_dropdown') - expect(rendered).not_to have_link('New branch') + expect(view).to render_template("projects/buttons/_dropdown") + expect(rendered).not_to have_link("New branch") end - it 'does not have a link to create a new tag' do + it "does not have a link to create a new tag" do render - expect(view).to render_template('projects/buttons/_dropdown') - expect(rendered).not_to have_link('New tag') + expect(view).to render_template("projects/buttons/_dropdown") + expect(rendered).not_to have_link("New tag") end end end diff --git a/spec/views/projects/ci/lints/show.html.haml_spec.rb b/spec/views/projects/ci/lints/show.html.haml_spec.rb index 2f0cd38c14a..9efc704a4d5 100644 --- a/spec/views/projects/ci/lints/show.html.haml_spec.rb +++ b/spec/views/projects/ci/lints/show.html.haml_spec.rb @@ -1,11 +1,11 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/ci/lints/show' do +describe "projects/ci/lints/show" do include Devise::Test::ControllerHelpers let(:project) { create(:project, :repository) } let(:config_processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(content)) } - describe 'XSS protection' do + describe "XSS protection" do before do assign(:project, project) assign(:status, true) @@ -14,51 +14,51 @@ describe 'projects/ci/lints/show' do assign(:jobs, config_processor.jobs) end - context 'when builds attrbiutes contain HTML nodes' do + context "when builds attrbiutes contain HTML nodes" do let(:content) do { rspec: { - script: '<h1>rspec</h1>', - stage: 'test' - } + script: "<h1>rspec</h1>", + stage: "test", + }, } end - it 'does not render HTML elements' do + it "does not render HTML elements" do render - expect(rendered).not_to have_css('h1', text: 'rspec') + expect(rendered).not_to have_css("h1", text: "rspec") end end - context 'when builds attributes do not contain HTML nodes' do + context "when builds attributes do not contain HTML nodes" do let(:content) do { rspec: { - script: 'rspec', - stage: 'test' - } + script: "rspec", + stage: "test", + }, } end - it 'shows configuration in the table' do + it "shows configuration in the table" do render - expect(rendered).to have_css('td pre', text: 'rspec') + expect(rendered).to have_css("td pre", text: "rspec") end end end - context 'when the content is valid' do + context "when the content is valid" do let(:content) do { build_template: { - script: './build.sh', - tags: ['dotnet'], - only: ['test@dude/repo'], - except: ['deploy'], - environment: 'testing' - } + script: "./build.sh", + tags: ["dotnet"], + only: ["test@dude/repo"], + except: ["deploy"], + environment: "testing", + }, } end @@ -70,30 +70,30 @@ describe 'projects/ci/lints/show' do assign(:jobs, config_processor.jobs) end - it 'shows the correct values' do + it "shows the correct values" do render - expect(rendered).to have_content('Tag list: dotnet') - expect(rendered).to have_content('Only policy: refs, test@dude/repo') - expect(rendered).to have_content('Except policy: refs, deploy') - expect(rendered).to have_content('Environment: testing') - expect(rendered).to have_content('When: on_success') + expect(rendered).to have_content("Tag list: dotnet") + expect(rendered).to have_content("Only policy: refs, test@dude/repo") + expect(rendered).to have_content("Except policy: refs, deploy") + expect(rendered).to have_content("Environment: testing") + expect(rendered).to have_content("When: on_success") end end - context 'when the content is invalid' do + context "when the content is invalid" do before do assign(:project, project) assign(:status, false) - assign(:error, 'Undefined error') + assign(:error, "Undefined error") end - it 'shows error message' do + it "shows error message" do render - expect(rendered).to have_content('Status: syntax is incorrect') - expect(rendered).to have_content('Error: Undefined error') - expect(rendered).not_to have_content('Tag list:') + expect(rendered).to have_content("Status: syntax is incorrect") + expect(rendered).to have_content("Error: Undefined error") + expect(rendered).not_to have_content("Tag list:") end end end diff --git a/spec/views/projects/commit/_commit_box.html.haml_spec.rb b/spec/views/projects/commit/_commit_box.html.haml_spec.rb index 1086546c10d..628bb7c50f2 100644 --- a/spec/views/projects/commit/_commit_box.html.haml_spec.rb +++ b/spec/views/projects/commit/_commit_box.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/commit/_commit_box.html.haml' do +describe "projects/commit/_commit_box.html.haml" do let(:user) { create(:user) } let(:project) { create(:project, :repository) } @@ -12,18 +12,18 @@ describe 'projects/commit/_commit_box.html.haml' do project.add_developer(user) end - it 'shows the commit SHA' do + it "shows the commit SHA" do render - expect(rendered).to have_text("#{Commit.truncate_sha(project.commit.sha)}") + expect(rendered).to have_text(Commit.truncate_sha(project.commit.sha).to_s) end - context 'when there is a pipeline present' do - context 'when there are multiple pipelines for a commit' do - it 'shows the last pipeline' do - create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success') - create(:ci_pipeline, project: project, sha: project.commit.id, status: 'canceled') - third_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'failed') + context "when there is a pipeline present" do + context "when there are multiple pipelines for a commit" do + it "shows the last pipeline" do + create(:ci_pipeline, project: project, sha: project.commit.id, status: "success") + create(:ci_pipeline, project: project, sha: project.commit.id, status: "canceled") + third_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: "failed") render @@ -31,43 +31,43 @@ describe 'projects/commit/_commit_box.html.haml' do end end - context 'when pipeline for the commit is blocked' do + context "when pipeline for the commit is blocked" do let!(:pipeline) do create(:ci_pipeline, :blocked, project: project, sha: project.commit.id) end - it 'shows correct pipeline description' do + it "shows correct pipeline description" do render expect(rendered).to have_text "Pipeline ##{pipeline.id} " \ - 'waiting for manual action' + "waiting for manual action" end end end - context 'viewing a commit' do - context 'as a developer' do + context "viewing a commit" do + context "as a developer" do before do allow(view).to receive(:can_collaborate_with_project?).and_return(true) end - it 'has a link to create a new tag' do + it "has a link to create a new tag" do render - expect(rendered).to have_link('Tag') + expect(rendered).to have_link("Tag") end end - context 'as a non-developer' do + context "as a non-developer" do before do project.add_guest(user) end - it 'does not have a link to create a new tag' do + it "does not have a link to create a new tag" do render - expect(rendered).not_to have_link('Tag') + expect(rendered).not_to have_link("Tag") end end end diff --git a/spec/views/projects/commit/branches.html.haml_spec.rb b/spec/views/projects/commit/branches.html.haml_spec.rb index b9d4dc80fe0..59ff753ac19 100644 --- a/spec/views/projects/commit/branches.html.haml_spec.rb +++ b/spec/views/projects/commit/branches.html.haml_spec.rb @@ -1,39 +1,39 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/commit/branches.html.haml' do +describe "projects/commit/branches.html.haml" do let(:project) { create(:project, :repository) } before do assign(:project, project) end - context 'when branches and tags are available' do + context "when branches and tags are available" do before do - assign(:branches, ['master', 'test-branch']) + assign(:branches, ["master", "test-branch"]) assign(:branches_limit_exceeded, false) - assign(:tags, ['tag1']) + assign(:tags, ["tag1"]) assign(:tags_limit_exceeded, false) render end - it 'shows default branch' do - expect(rendered).to have_link('master') + it "shows default branch" do + expect(rendered).to have_link("master") end - it 'shows js expand link' do - expect(rendered).to have_selector('.js-details-expand') + it "shows js expand link" do + expect(rendered).to have_selector(".js-details-expand") end - it 'shows branch and tag links' do - expect(rendered).to have_link('test-branch') - expect(rendered).to have_link('tag1') + it "shows branch and tag links" do + expect(rendered).to have_link("test-branch") + expect(rendered).to have_link("tag1") end end - context 'when branches are available but no tags' do + context "when branches are available but no tags" do before do - assign(:branches, ['master', 'test-branch']) + assign(:branches, ["master", "test-branch"]) assign(:branches_limit_exceeded, false) assign(:tags, []) assign(:tags_limit_exceeded, true) @@ -41,51 +41,51 @@ describe 'projects/commit/branches.html.haml' do render end - it 'shows branches' do - expect(rendered).to have_link('master') - expect(rendered).to have_link('test-branch') + it "shows branches" do + expect(rendered).to have_link("master") + expect(rendered).to have_link("test-branch") end - it 'shows js expand link' do - expect(rendered).to have_selector('.js-details-expand') + it "shows js expand link" do + expect(rendered).to have_selector(".js-details-expand") end - it 'shows limit exceeded message for tags' do - expect(rendered).to have_text('Tags unavailable') + it "shows limit exceeded message for tags" do + expect(rendered).to have_text("Tags unavailable") end end - context 'when tags are available but no branches (just default)' do + context "when tags are available but no branches (just default)" do before do - assign(:branches, ['master']) + assign(:branches, ["master"]) assign(:branches_limit_exceeded, true) - assign(:tags, %w(tag1 tag2)) + assign(:tags, %w[tag1 tag2]) assign(:tags_limit_exceeded, false) render end - it 'shows default branch' do - expect(rendered).to have_text('master') + it "shows default branch" do + expect(rendered).to have_text("master") end - it 'shows js expand link' do - expect(rendered).to have_selector('.js-details-expand') + it "shows js expand link" do + expect(rendered).to have_selector(".js-details-expand") end - it 'shows tags' do - expect(rendered).to have_link('tag1') - expect(rendered).to have_link('tag2') + it "shows tags" do + expect(rendered).to have_link("tag1") + expect(rendered).to have_link("tag2") end - it 'shows limit exceeded for branches' do - expect(rendered).to have_text('Branches unavailable') + it "shows limit exceeded for branches" do + expect(rendered).to have_text("Branches unavailable") end end - context 'when branches and tags are not available' do + context "when branches and tags are not available" do before do - assign(:branches, ['master']) + assign(:branches, ["master"]) assign(:branches_limit_exceeded, true) assign(:tags, []) assign(:tags_limit_exceeded, true) @@ -93,17 +93,17 @@ describe 'projects/commit/branches.html.haml' do render end - it 'shows default branch' do - expect(rendered).to have_text('master') + it "shows default branch" do + expect(rendered).to have_text("master") end - it 'shows js expand link' do - expect(rendered).to have_selector('.js-details-expand') + it "shows js expand link" do + expect(rendered).to have_selector(".js-details-expand") end - it 'shows too many to search' do - expect(rendered).to have_text('Branches unavailable') - expect(rendered).to have_text('Tags unavailable') + it "shows too many to search" do + expect(rendered).to have_text("Branches unavailable") + expect(rendered).to have_text("Tags unavailable") end end end diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index d07099489e5..df172947e5c 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/commit/show.html.haml' do +describe "projects/commit/show.html.haml" do let(:project) { create(:project, :repository) } let(:commit) { project.commit } @@ -16,10 +16,10 @@ describe 'projects/commit/show.html.haml' do allow(view).to receive(:can?).and_return(false) allow(view).to receive(:can_collaborate_with_project?).and_return(false) allow(view).to receive(:current_ref).and_return(project.repository.root_ref) - allow(view).to receive(:diff_btn).and_return('') + allow(view).to receive(:diff_btn).and_return("") end - context 'inline diff view' do + context "inline diff view" do before do allow(view).to receive(:diff_view).and_return(:inline) allow(view).to receive(:diff_view).and_return(:inline) @@ -27,12 +27,12 @@ describe 'projects/commit/show.html.haml' do render end - it 'has limited width' do - expect(rendered).to have_selector('.limit-container-width') + it "has limited width" do + expect(rendered).to have_selector(".limit-container-width") end end - context 'parallel diff view' do + context "parallel diff view" do before do allow(view).to receive(:diff_view).and_return(:parallel) allow(view).to receive(:fluid_layout).and_return(true) @@ -40,12 +40,12 @@ describe 'projects/commit/show.html.haml' do render end - it 'spans full width' do - expect(rendered).not_to have_selector('.limit-container-width') + it "spans full width" do + expect(rendered).not_to have_selector(".limit-container-width") end end - context 'in the context of a merge request' do + context "in the context of a merge request" do let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } before do @@ -53,7 +53,7 @@ describe 'projects/commit/show.html.haml' do render end - it 'shows that it is in the context of a merge request' do + it "shows that it is in the context of a merge request" do merge_request_url = diffs_project_merge_request_path(project, merge_request, commit_id: commit.id) expect(rendered).to have_content("This commit is part of merge request") expect(rendered).to have_link(merge_request.to_reference, href: merge_request_url) diff --git a/spec/views/projects/commits/_commit.html.haml_spec.rb b/spec/views/projects/commits/_commit.html.haml_spec.rb index 6bf1b5fd2d0..64a5a8877ad 100644 --- a/spec/views/projects/commits/_commit.html.haml_spec.rb +++ b/spec/views/projects/commits/_commit.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/commits/_commit.html.haml' do +describe "projects/commits/_commit.html.haml" do let(:project) { create(:project, :repository) } let(:commit) { project.repository.commit(ref) } @@ -8,24 +8,24 @@ describe 'projects/commits/_commit.html.haml' do allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) end - context 'with a signed commit' do + context "with a signed commit" do let(:ref) { GpgHelpers::SIGNED_COMMIT_SHA } - it 'does not display a loading spinner for GPG status' do - render partial: 'projects/commits/commit', locals: { + it "does not display a loading spinner for GPG status" do + render partial: "projects/commits/commit", locals: { project: project, ref: ref, - commit: commit + commit: commit, } - within '.gpg-status-box' do - expect(page).not_to have_css('i.fa.fa-spinner.fa-spin') + within ".gpg-status-box" do + expect(page).not_to have_css("i.fa.fa-spinner.fa-spin") end end end - context 'with ci status' do - let(:ref) { 'master' } + context "with ci status" do + let(:ref) { "master" } let(:user) { create(:user) } before do @@ -35,42 +35,42 @@ describe 'projects/commits/_commit.html.haml' do create( :ci_empty_pipeline, - ref: 'master', + ref: "master", sha: commit.id, - status: 'success', + status: "success", project: project ) end - context 'when pipelines are disabled' do + context "when pipelines are disabled" do before do allow(project).to receive(:builds_enabled?).and_return(false) end - it 'does not display a ci status icon' do - render partial: 'projects/commits/commit', locals: { + it "does not display a ci status icon" do + render partial: "projects/commits/commit", locals: { project: project, ref: ref, - commit: commit + commit: commit, } - expect(rendered).not_to have_css('.ci-status-link') + expect(rendered).not_to have_css(".ci-status-link") end end - context 'when pipelines are enabled' do + context "when pipelines are enabled" do before do allow(project).to receive(:builds_enabled?).and_return(true) end - it 'does display a ci status icon when pipelines are enabled' do - render partial: 'projects/commits/commit', locals: { + it "does display a ci status icon when pipelines are enabled" do + render partial: "projects/commits/commit", locals: { project: project, ref: ref, - commit: commit + commit: commit, } - expect(rendered).to have_css('.ci-status-link') + expect(rendered).to have_css(".ci-status-link") end end end diff --git a/spec/views/projects/diffs/_stats.html.haml_spec.rb b/spec/views/projects/diffs/_stats.html.haml_spec.rb index c7d2f85747c..4db3459d508 100644 --- a/spec/views/projects/diffs/_stats.html.haml_spec.rb +++ b/spec/views/projects/diffs/_stats.html.haml_spec.rb @@ -1,56 +1,56 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/diffs/_stats.html.haml' do +describe "projects/diffs/_stats.html.haml" do let(:project) { create(:project, :repository) } - let(:commit) { project.commit('570e7b2abdd848b95f2f578043fc23bd6f6fd24d') } + let(:commit) { project.commit("570e7b2abdd848b95f2f578043fc23bd6f6fd24d") } def render_view - render partial: "projects/diffs/stats", locals: { diff_files: commit.diffs.diff_files } + render partial: "projects/diffs/stats", locals: {diff_files: commit.diffs.diff_files} end - context 'when the commit contains several changes' do - it 'uses plural for additions' do + context "when the commit contains several changes" do + it "uses plural for additions" do render_view - expect(rendered).to have_text('additions') + expect(rendered).to have_text("additions") end - it 'uses plural for deletions' do + it "uses plural for deletions" do render_view end end - context 'when the commit contains no addition and no deletions' do - let(:commit) { project.commit('4cd80ccab63c82b4bad16faa5193fbd2aa06df40') } + context "when the commit contains no addition and no deletions" do + let(:commit) { project.commit("4cd80ccab63c82b4bad16faa5193fbd2aa06df40") } - it 'uses plural for additions' do + it "uses plural for additions" do render_view - expect(rendered).to have_text('additions') + expect(rendered).to have_text("additions") end - it 'uses plural for deletions' do + it "uses plural for deletions" do render_view - expect(rendered).to have_text('deletions') + expect(rendered).to have_text("deletions") end end - context 'when the commit contains exactly one addition and one deletion' do - let(:commit) { project.commit('08f22f255f082689c0d7d39d19205085311542bc') } + context "when the commit contains exactly one addition and one deletion" do + let(:commit) { project.commit("08f22f255f082689c0d7d39d19205085311542bc") } - it 'uses singular for additions' do + it "uses singular for additions" do render_view - expect(rendered).to have_text('addition') - expect(rendered).not_to have_text('additions') + expect(rendered).to have_text("addition") + expect(rendered).not_to have_text("additions") end - it 'uses singular for deletions' do + it "uses singular for deletions" do render_view - expect(rendered).to have_text('deletion') - expect(rendered).not_to have_text('deletions') + expect(rendered).to have_text("deletion") + expect(rendered).not_to have_text("deletions") end end end diff --git a/spec/views/projects/diffs/_viewer.html.haml_spec.rb b/spec/views/projects/diffs/_viewer.html.haml_spec.rb index 8ac32db5585..486d2a6d8ab 100644 --- a/spec/views/projects/diffs/_viewer.html.haml_spec.rb +++ b/spec/views/projects/diffs/_viewer.html.haml_spec.rb @@ -1,17 +1,17 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/diffs/_viewer.html.haml' do +describe "projects/diffs/_viewer.html.haml" do include FakeBlobHelpers let(:project) { create(:project, :repository) } - let(:commit) { project.commit('570e7b2abdd848b95f2f578043fc23bd6f6fd24d') } - let(:diff_file) { commit.diffs.diff_file_with_new_path('files/ruby/popen.rb') } + let(:commit) { project.commit("570e7b2abdd848b95f2f578043fc23bd6f6fd24d") } + let(:diff_file) { commit.diffs.diff_file_with_new_path("files/ruby/popen.rb") } let(:viewer_class) do Class.new(DiffViewer::Base) do include DiffViewer::Rich - self.partial_name = 'text' + self.partial_name = "text" end end @@ -20,52 +20,52 @@ describe 'projects/diffs/_viewer.html.haml' do before do assign(:project, project) - controller.params[:controller] = 'projects/commit' - controller.params[:action] = 'show' + controller.params[:controller] = "projects/commit" + controller.params[:action] = "show" controller.params[:namespace_id] = project.namespace.to_param controller.params[:project_id] = project.to_param controller.params[:id] = commit.id end def render_view - render partial: 'projects/diffs/viewer', locals: { viewer: viewer } + render partial: "projects/diffs/viewer", locals: {viewer: viewer} end - context 'when there is a render error' do + context "when there is a render error" do before do allow(viewer).to receive(:render_error).and_return(:too_large) end - it 'renders the error' do + it "renders the error" do render_view - expect(view).to render_template('projects/diffs/_render_error') + expect(view).to render_template("projects/diffs/_render_error") end end - context 'when the viewer is collapsed' do + context "when the viewer is collapsed" do before do allow(diff_file).to receive(:collapsed?).and_return(true) end - it 'renders the collapsed view' do + it "renders the collapsed view" do render_view - expect(view).to render_template('projects/diffs/_collapsed') + expect(view).to render_template("projects/diffs/_collapsed") end end - context 'when there is no render error' do - it 'prepares the viewer' do + context "when there is no render error" do + it "prepares the viewer" do expect(viewer).to receive(:prepare!) render_view end - it 'renders the viewer' do + it "renders the viewer" do render_view - expect(view).to render_template('projects/diffs/viewers/_text') + expect(view).to render_template("projects/diffs/viewers/_text") end end end diff --git a/spec/views/projects/edit.html.haml_spec.rb b/spec/views/projects/edit.html.haml_spec.rb index 5c6b2e4b042..d688fc9a83c 100644 --- a/spec/views/projects/edit.html.haml_spec.rb +++ b/spec/views/projects/edit.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/edit' do +describe "projects/edit" do include Devise::Test::ControllerHelpers let(:project) { create(:project) } @@ -15,13 +15,13 @@ describe 'projects/edit' do current_application_settings: Gitlab::CurrentSettings.current_application_settings) end - context 'project export disabled' do - it 'does not display the project export option' do + context "project export disabled" do + it "does not display the project export option" do stub_application_setting(project_export_enabled?: false) render - expect(rendered).not_to have_content('Export project') + expect(rendered).not_to have_content("Export project") end end end diff --git a/spec/views/projects/environments/terminal.html.haml_spec.rb b/spec/views/projects/environments/terminal.html.haml_spec.rb index d2e47225226..126909b8125 100644 --- a/spec/views/projects/environments/terminal.html.haml_spec.rb +++ b/spec/views/projects/environments/terminal.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/environments/terminal' do +describe "projects/environments/terminal" do let!(:environment) { create(:environment, :with_review_app) } before do @@ -10,23 +10,23 @@ describe 'projects/environments/terminal' do allow(view).to receive(:can?).and_return(true) end - context 'when environment has external URL' do - it 'shows external URL button' do - environment.update_attribute(:external_url, 'https://gitlab.com') + context "when environment has external URL" do + it "shows external URL button" do + environment.update_attribute(:external_url, "https://gitlab.com") render - expect(rendered).to have_link(nil, href: 'https://gitlab.com') + expect(rendered).to have_link(nil, href: "https://gitlab.com") end end - context 'when environment does not have external URL' do - it 'shows external URL button' do + context "when environment does not have external URL" do + it "shows external URL button" do environment.update_attribute(:external_url, nil) render - expect(rendered).not_to have_link(nil, href: 'https://gitlab.com') + expect(rendered).not_to have_link(nil, href: "https://gitlab.com") end end end diff --git a/spec/views/projects/imports/new.html.haml_spec.rb b/spec/views/projects/imports/new.html.haml_spec.rb index 11fe144d1d2..433e7e402d2 100644 --- a/spec/views/projects/imports/new.html.haml_spec.rb +++ b/spec/views/projects/imports/new.html.haml_spec.rb @@ -3,8 +3,8 @@ require "spec_helper" describe "projects/imports/new.html.haml" do let(:user) { create(:user) } - context 'when import fails' do - let(:project) { create(:project_empty_repo, :import_failed, import_type: :gitlab_project, import_source: '/var/opt/gitlab/gitlab-rails/shared/tmp/project_exports/uploads/t.tar.gz', import_url: nil) } + context "when import fails" do + let(:project) { create(:project_empty_repo, :import_failed, import_type: :gitlab_project, import_source: "/var/opt/gitlab/gitlab-rails/shared/tmp/project_exports/uploads/t.tar.gz", import_url: nil) } before do project.import_state.update(last_error: '<a href="http://googl.com">Foo</a>') @@ -17,7 +17,7 @@ describe "projects/imports/new.html.haml" do render - expect(rendered).not_to have_link('Foo', href: "http://googl.com") + expect(rendered).not_to have_link("Foo", href: "http://googl.com") end end end diff --git a/spec/views/projects/issues/_merge_requests_status.html.haml_spec.rb b/spec/views/projects/issues/_merge_requests_status.html.haml_spec.rb index 02c225292ce..c2f2ff4bf3d 100644 --- a/spec/views/projects/issues/_merge_requests_status.html.haml_spec.rb +++ b/spec/views/projects/issues/_merge_requests_status.html.haml_spec.rb @@ -1,21 +1,22 @@ # frozen_string_literal: true -require 'spec_helper' -describe 'projects/issues/_merge_requests_status.html.haml' do - it 'shows date of status change in tooltip' do +require "spec_helper" + +describe "projects/issues/_merge_requests_status.html.haml" do + it "shows date of status change in tooltip" do merge_request = create(:merge_request, created_at: 1.month.ago) - render partial: 'projects/issues/merge_requests_status', - locals: { merge_request: merge_request, css_class: '' } + render partial: "projects/issues/merge_requests_status", + locals: {merge_request: merge_request, css_class: ""} expect(rendered).to match("Opened.*about 1 month ago") end - it 'shows only status in tooltip if date is not set' do + it "shows only status in tooltip if date is not set" do merge_request = create(:merge_request, state: :closed) - render partial: 'projects/issues/merge_requests_status', - locals: { merge_request: merge_request, css_class: '' } + render partial: "projects/issues/merge_requests_status", + locals: {merge_request: merge_request, css_class: ""} expect(rendered).to match("Closed") end diff --git a/spec/views/projects/issues/_related_branches.html.haml_spec.rb b/spec/views/projects/issues/_related_branches.html.haml_spec.rb index 5cff7694029..83b2510e0c3 100644 --- a/spec/views/projects/issues/_related_branches.html.haml_spec.rb +++ b/spec/views/projects/issues/_related_branches.html.haml_spec.rb @@ -1,16 +1,16 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/issues/_related_branches' do +describe "projects/issues/_related_branches" do include Devise::Test::ControllerHelpers let(:user) { create(:user) } let(:project) { create(:project, :repository) } - let(:branch) { project.repository.find_branch('feature') } - let!(:pipeline) { create(:ci_pipeline, project: project, sha: branch.dereferenced_target.id, ref: 'feature') } + let(:branch) { project.repository.find_branch("feature") } + let!(:pipeline) { create(:ci_pipeline, project: project, sha: branch.dereferenced_target.id, ref: "feature") } before do assign(:project, project) - assign(:related_branches, ['feature']) + assign(:related_branches, ["feature"]) project.add_developer(user) allow(view).to receive(:current_user).and_return(user) @@ -18,8 +18,8 @@ describe 'projects/issues/_related_branches' do render end - it 'shows the related branches with their build status' do - expect(rendered).to match('feature') - expect(rendered).to have_css('.related-branch-ci-status') + it "shows the related branches with their build status" do + expect(rendered).to match("feature") + expect(rendered).to have_css(".related-branch-ci-status") end end diff --git a/spec/views/projects/issues/show.html.haml_spec.rb b/spec/views/projects/issues/show.html.haml_spec.rb index 1d9c6d36ad7..15f913f4a99 100644 --- a/spec/views/projects/issues/show.html.haml_spec.rb +++ b/spec/views/projects/issues/show.html.haml_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require 'spec_helper' +require "spec_helper" -describe 'projects/issues/show' do +describe "projects/issues/show" do let(:project) { create(:project, :repository) } let(:issue) { create(:issue, project: project, author: user) } let(:user) { create(:user) } @@ -11,17 +11,17 @@ describe 'projects/issues/show' do assign(:project, project) assign(:issue, issue) assign(:noteable, issue) - stub_template 'shared/issuable/_sidebar' => '' - stub_template 'projects/issues/_discussion' => '' - allow(view).to receive(:issuable_meta).and_return('') + stub_template "shared/issuable/_sidebar" => "" + stub_template "projects/issues/_discussion" => "" + allow(view).to receive(:issuable_meta).and_return("") end - context 'when the issue is closed' do + context "when the issue is closed" do before do allow(issue).to receive(:closed?).and_return(true) end - context 'when the issue was moved' do + context "when the issue was moved" do let(:new_issue) { create(:issue, project: project, author: user) } before do @@ -31,24 +31,24 @@ describe 'projects/issues/show' do it 'shows "Closed (moved)" if an issue has been moved' do render - expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)') + expect(rendered).to have_selector(".status-box-issue-closed:not(.hidden)", text: "Closed (moved)") end it 'links "moved" to the new issue the original issue was moved to' do render - expect(rendered).to have_selector("a[href=\"#{issue_path(new_issue)}\"]", text: 'moved') + expect(rendered).to have_selector("a[href=\"#{issue_path(new_issue)}\"]", text: "moved") end end it 'shows "Closed" if an issue has not been moved' do render - expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed') + expect(rendered).to have_selector(".status-box-issue-closed:not(.hidden)", text: "Closed") end end - context 'when the issue is open' do + context "when the issue is open" do before do allow(issue).to receive(:closed?).and_return(false) allow(issue).to receive(:disscussion_locked).and_return(false) @@ -57,7 +57,7 @@ describe 'projects/issues/show' do it 'shows "Open" if an issue has been moved' do render - expect(rendered).to have_selector('.status-box-open:not(.hidden)', text: 'Open') + expect(rendered).to have_selector(".status-box-open:not(.hidden)", text: "Open") end end end diff --git a/spec/views/projects/jobs/_build.html.haml_spec.rb b/spec/views/projects/jobs/_build.html.haml_spec.rb index 1d58891036e..4a5e4509916 100644 --- a/spec/views/projects/jobs/_build.html.haml_spec.rb +++ b/spec/views/projects/jobs/_build.html.haml_spec.rb @@ -1,28 +1,28 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/ci/jobs/_build' do +describe "projects/ci/jobs/_build" do include Devise::Test::ControllerHelpers let(:project) { create(:project, :repository) } let(:pipeline) { create(:ci_empty_pipeline, id: 1337, project: project, sha: project.commit.id) } - let(:build) { create(:ci_build, pipeline: pipeline, stage: 'test', stage_idx: 1, name: 'rspec 0:2', status: :pending) } + let(:build) { create(:ci_build, pipeline: pipeline, stage: "test", stage_idx: 1, name: "rspec 0:2", status: :pending) } before do - controller.prepend_view_path('app/views/projects') + controller.prepend_view_path("app/views/projects") allow(view).to receive(:can?).and_return(true) end - it 'won\'t include a column with a link to its pipeline by default' do - render partial: 'projects/ci/builds/build', locals: { build: build } + it "won't include a column with a link to its pipeline by default" do + render partial: "projects/ci/builds/build", locals: {build: build} - expect(rendered).not_to have_link('#1337') - expect(rendered).not_to have_text('#1337 by API') + expect(rendered).not_to have_link("#1337") + expect(rendered).not_to have_text("#1337 by API") end - it 'can include a column with a link to its pipeline' do - render partial: 'projects/ci/builds/build', locals: { build: build, pipeline_link: true } + it "can include a column with a link to its pipeline" do + render partial: "projects/ci/builds/build", locals: {build: build, pipeline_link: true} - expect(rendered).to have_link('#1337') - expect(rendered).to have_text('#1337 by API') + expect(rendered).to have_link("#1337") + expect(rendered).to have_text("#1337 by API") end end diff --git a/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb b/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb index dc2ffc9dc47..6dd0c771c6b 100644 --- a/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb +++ b/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb @@ -1,28 +1,28 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/generic_commit_statuses/_generic_commit_status.html.haml' do +describe "projects/generic_commit_statuses/_generic_commit_status.html.haml" do include Devise::Test::ControllerHelpers let(:project) { create(:project, :repository) } let(:pipeline) { create(:ci_empty_pipeline, id: 1337, project: project, sha: project.commit.id) } - let(:generic_commit_status) { create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3) } + let(:generic_commit_status) { create(:generic_commit_status, pipeline: pipeline, stage: "external", name: "jenkins", stage_idx: 3) } before do - controller.prepend_view_path('app/views/projects') + controller.prepend_view_path("app/views/projects") allow(view).to receive(:can?).and_return(true) end - it 'won\'t include a column with a link to its pipeline by default' do - render partial: 'projects/generic_commit_statuses/generic_commit_status', locals: { generic_commit_status: generic_commit_status } + it "won't include a column with a link to its pipeline by default" do + render partial: "projects/generic_commit_statuses/generic_commit_status", locals: {generic_commit_status: generic_commit_status} - expect(rendered).not_to have_link('#1337') - expect(rendered).not_to have_text('#1337 by API') + expect(rendered).not_to have_link("#1337") + expect(rendered).not_to have_text("#1337 by API") end - it 'can include a column with a link to its pipeline' do - render partial: 'projects/generic_commit_statuses/generic_commit_status', locals: { generic_commit_status: generic_commit_status, pipeline_link: true } + it "can include a column with a link to its pipeline" do + render partial: "projects/generic_commit_statuses/generic_commit_status", locals: {generic_commit_status: generic_commit_status, pipeline_link: true} - expect(rendered).to have_link('#1337') - expect(rendered).to have_text('#1337 by API') + expect(rendered).to have_link("#1337") + expect(rendered).to have_text("#1337 by API") end end diff --git a/spec/views/projects/jobs/show.html.haml_spec.rb b/spec/views/projects/jobs/show.html.haml_spec.rb index e06a9ecb98b..b0b5c70e082 100644 --- a/spec/views/projects/jobs/show.html.haml_spec.rb +++ b/spec/views/projects/jobs/show.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/jobs/show' do +describe "projects/jobs/show" do let(:user) { create(:user) } let(:project) { create(:project, :repository) } let(:build) { create(:ci_build, pipeline: pipeline) } @@ -18,19 +18,19 @@ describe 'projects/jobs/show' do allow(view).to receive(:can?).and_return(true) end - context 'when job is running' do + context "when job is running" do let(:build) { create(:ci_build, :trace_live, :running, pipeline: pipeline) } before do render end - it 'does not show retry button' do - expect(rendered).not_to have_link('Retry') + it "does not show retry button" do + expect(rendered).not_to have_link("Retry") end - it 'does not show New issue button' do - expect(rendered).not_to have_link('New issue') + it "does not show New issue button" do + expect(rendered).not_to have_link("New issue") end end end diff --git a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb index a7628548de6..aa1630ee52a 100644 --- a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/merge_requests/_commits.html.haml' do +describe "projects/merge_requests/_commits.html.haml" do include Devise::Test::ControllerHelpers include ProjectForksHelper @@ -16,14 +16,14 @@ describe 'projects/merge_requests/_commits.html.haml' do end before do - controller.prepend_view_path('app/views/projects') + controller.prepend_view_path("app/views/projects") assign(:merge_request, merge_request) assign(:commits, merge_request.commits) assign(:hidden_commit_count, 0) end - it 'shows commits from source project' do + it "shows commits from source project" do render commit = merge_request.commits.first # HEAD @@ -32,12 +32,12 @@ describe 'projects/merge_requests/_commits.html.haml' do expect(rendered).to have_link(href: href) end - context 'when there are hidden commits' do + context "when there are hidden commits" do before do assign(:hidden_commit_count, 1) end - it 'shows notice about omitted commits' do + it "shows notice about omitted commits" do render expect(rendered).to match(/1 additional commit has been omitted to prevent performance issues/) diff --git a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb index 0206928a211..5e1c28f1b10 100644 --- a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb @@ -1,11 +1,11 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/merge_requests/creations/_new_submit.html.haml' do +describe "projects/merge_requests/creations/_new_submit.html.haml" do let(:merge_request) { create(:merge_request) } let!(:pipeline) { create(:ci_empty_pipeline) } before do - controller.prepend_view_path('app/views/projects') + controller.prepend_view_path("app/views/projects") assign(:merge_request, merge_request) assign(:commits, merge_request.commits) @@ -15,31 +15,31 @@ describe 'projects/merge_requests/creations/_new_submit.html.haml' do assign(:mr_presenter, merge_request.present(current_user: merge_request.author)) allow(view).to receive(:can?).and_return(true) - allow(view).to receive(:url_for).and_return('#') + allow(view).to receive(:url_for).and_return("#") allow(view).to receive(:current_user).and_return(merge_request.author) allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) end - context 'when there are pipelines for merge request but no pipeline for last commit' do + context "when there are pipelines for merge request but no pipeline for last commit" do before do assign(:pipelines, Ci::Pipeline.all) assign(:pipeline, nil) end - it 'shows <<Pipelines>> tab and hides <<Builds>> tab' do + it "shows <<Pipelines>> tab and hides <<Builds>> tab" do render - expect(rendered).to have_text('Pipelines 1') - expect(rendered).not_to have_text('Builds') + expect(rendered).to have_text("Pipelines 1") + expect(rendered).not_to have_text("Builds") end end - context 'when there are hidden commits' do + context "when there are hidden commits" do before do assign(:pipelines, Ci::Pipeline.none) assign(:hidden_commit_count, 2) end - it 'shows notice about omitted commits' do + it "shows notice about omitted commits" do render expect(rendered).to match(/2 additional commits have been omitted to prevent performance issues/) diff --git a/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb b/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb index e7c40421f1f..ce8a7ae0cbe 100644 --- a/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/merge_requests/diffs/_diffs.html.haml' do +describe "projects/merge_requests/diffs/_diffs.html.haml" do include Devise::Test::ControllerHelpers let(:user) { create(:user) } @@ -20,7 +20,7 @@ describe 'projects/merge_requests/diffs/_diffs.html.haml' do assign(:notes, []) end - context 'for a commit' do + context "for a commit" do let(:commit) { merge_request.commits.last } before do 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 c13eab30054..d7828aca740 100644 --- a/spec/views/projects/merge_requests/edit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/edit.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/merge_requests/edit.html.haml' do +describe "projects/merge_requests/edit.html.haml" do include Devise::Test::ControllerHelpers include ProjectForksHelper @@ -31,30 +31,30 @@ describe 'projects/merge_requests/edit.html.haml' do .and_return(User.find(closed_merge_request.author_id)) end - context 'when a merge request without fork' do + context "when a merge request without fork" do it "shows editable fields" do unlink_project.execute closed_merge_request.reload render - expect(rendered).to have_field('merge_request[title]') - expect(rendered).to have_field('merge_request[description]') - expect(rendered).to have_selector('#merge_request_assignee_id', visible: false) - expect(rendered).to have_selector('#merge_request_milestone_id', visible: false) - expect(rendered).not_to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).to have_field("merge_request[title]") + expect(rendered).to have_field("merge_request[description]") + expect(rendered).to have_selector("#merge_request_assignee_id", visible: false) + expect(rendered).to have_selector("#merge_request_milestone_id", visible: false) + expect(rendered).not_to have_selector("#merge_request_target_branch", visible: false) end end - context 'when a merge request with an existing source project is closed' do + context "when a merge request with an existing source project is closed" do it "shows editable fields" do render - expect(rendered).to have_field('merge_request[title]') - expect(rendered).to have_field('merge_request[description]') - expect(rendered).to have_selector('#merge_request_assignee_id', visible: false) - expect(rendered).to have_selector('#merge_request_milestone_id', visible: false) - expect(rendered).to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).to have_field("merge_request[title]") + expect(rendered).to have_field("merge_request[description]") + expect(rendered).to have_selector("#merge_request_assignee_id", visible: false) + expect(rendered).to have_selector("#merge_request_milestone_id", visible: false) + expect(rendered).to have_selector("#merge_request_target_branch", visible: false) end end end diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb index d9bda1a3414..f72f9e93298 100644 --- a/spec/views/projects/merge_requests/show.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/merge_requests/show.html.haml' do +describe "projects/merge_requests/show.html.haml" do include Devise::Test::ControllerHelpers include ProjectForksHelper @@ -41,21 +41,21 @@ describe 'projects/merge_requests/show.html.haml' do current_application_settings: Gitlab::CurrentSettings.current_application_settings) end - describe 'merge request assignee sidebar' do - context 'when assignee is allowed to merge' do - it 'does not show a warning icon' do + describe "merge request assignee sidebar" do + context "when assignee is allowed to merge" do + it "does not show a warning icon" do closed_merge_request.update(assignee_id: user.id) project.add_maintainer(user) assign(:issuable_sidebar, serialize_issuable_sidebar(user, project, closed_merge_request)) render - expect(rendered).not_to have_css('.cannot-be-merged') + expect(rendered).not_to have_css(".cannot-be-merged") end end - context 'when assignee is not allowed to merge' do - it 'shows a warning icon' do + context "when assignee is not allowed to merge" do + it "shows a warning icon" do reporter = create(:user) project.add_reporter(reporter) closed_merge_request.update(assignee_id: reporter.id) @@ -63,17 +63,17 @@ describe 'projects/merge_requests/show.html.haml' do render - expect(rendered).to have_css('.cannot-be-merged') + expect(rendered).to have_css(".cannot-be-merged") end end end - context 'when the merge request is closed' do + context "when the merge request is closed" do it 'shows the "Reopen" button' do render - expect(rendered).to have_css('a', visible: true, text: 'Reopen') - expect(rendered).to have_css('a', visible: false, text: 'Close') + expect(rendered).to have_css("a", visible: true, text: "Reopen") + expect(rendered).to have_css("a", visible: false, text: "Close") end it 'does not show the "Reopen" button when the source project does not exist' do @@ -83,14 +83,14 @@ describe 'projects/merge_requests/show.html.haml' do render - expect(rendered).to have_css('a', visible: false, text: 'Reopen') - expect(rendered).to have_css('a', visible: false, text: 'Close') + expect(rendered).to have_css("a", visible: false, text: "Reopen") + expect(rendered).to have_css("a", visible: false, text: "Close") end end - context 'when the merge request is open' do - it 'closes the merge request if the source project does not exist' do - closed_merge_request.update(state: 'open') + context "when the merge request is open" do + it "closes the merge request if the source project does not exist" do + closed_merge_request.update(state: "open") forked_project.destroy # Reload merge request so MergeRequest#source_project turns to `nil` closed_merge_request.reload @@ -98,15 +98,15 @@ describe 'projects/merge_requests/show.html.haml' do render - expect(closed_merge_request.reload.state).to eq('closed') - expect(rendered).to have_css('a', visible: false, text: 'Reopen') - expect(rendered).to have_css('a', visible: false, text: 'Close') + expect(closed_merge_request.reload.state).to eq("closed") + expect(rendered).to have_css("a", visible: false, text: "Reopen") + expect(rendered).to have_css("a", visible: false, text: "Close") end end def serialize_issuable_sidebar(user, project, merge_request) MergeRequestSerializer .new(current_user: user, project: project) - .represent(closed_merge_request, serializer: 'sidebar') + .represent(closed_merge_request, serializer: "sidebar") end end diff --git a/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb b/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb index 8a9ab02eaca..6353bde2ba7 100644 --- a/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb +++ b/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/notes/_more_actions_dropdown' do +describe "projects/notes/_more_actions_dropdown" do let(:author_user) { create(:user) } let(:not_author_user) { create(:user) } @@ -12,28 +12,28 @@ describe 'projects/notes/_more_actions_dropdown' do assign(:project, project) end - it 'shows Report abuse to GitLab button if not editable and not current users comment' do - render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: false, note: note + it "shows Report abuse to GitLab button if not editable and not current users comment" do + render "projects/notes/more_actions_dropdown", current_user: not_author_user, note_editable: false, note: note - expect(rendered).to have_link('Report abuse to GitLab') + expect(rendered).to have_link("Report abuse to GitLab") end - it 'does not show the More actions button if not editable and current users comment' do - render 'projects/notes/more_actions_dropdown', current_user: author_user, note_editable: false, note: note + it "does not show the More actions button if not editable and current users comment" do + render "projects/notes/more_actions_dropdown", current_user: author_user, note_editable: false, note: note - expect(rendered).not_to have_selector('.dropdown.more-actions') + expect(rendered).not_to have_selector(".dropdown.more-actions") end - it 'shows Report abuse to GitLab and Delete buttons if editable and not current users comment' do - render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: true, note: note + it "shows Report abuse to GitLab and Delete buttons if editable and not current users comment" do + render "projects/notes/more_actions_dropdown", current_user: not_author_user, note_editable: true, note: note - expect(rendered).to have_link('Report abuse to GitLab') - expect(rendered).to have_link('Delete comment') + expect(rendered).to have_link("Report abuse to GitLab") + expect(rendered).to have_link("Delete comment") end - it 'shows Delete button if editable and current users comment' do - render 'projects/notes/more_actions_dropdown', current_user: author_user, note_editable: true, note: note + it "shows Delete button if editable and current users comment" do + render "projects/notes/more_actions_dropdown", current_user: author_user, note_editable: true, note: note - expect(rendered).to have_link('Delete comment') + expect(rendered).to have_link("Delete comment") end end diff --git a/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb b/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb index 5d60d6bc5e7..60a0d8a006f 100644 --- a/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb +++ b/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/pipeline_schedules/_pipeline_schedule' do +describe "projects/pipeline_schedules/_pipeline_schedule" do let(:owner) { create(:user) } let(:maintainer) { create(:user) } let(:project) { create(:project) } @@ -15,32 +15,32 @@ describe 'projects/pipeline_schedules/_pipeline_schedule' do allow(view).to receive(:can?).and_return(true) end - context 'taking ownership of schedule' do - context 'when non-owner is signed in' do + context "taking ownership of schedule" do + context "when non-owner is signed in" do let(:user) { maintainer } before do allow(view).to receive(:can?).with(maintainer, :take_ownership_pipeline_schedule, pipeline_schedule).and_return(true) end - it 'non-owner can take ownership of pipeline' do + it "non-owner can take ownership of pipeline" do render - expect(rendered).to have_link('Take ownership') + expect(rendered).to have_link("Take ownership") end end - context 'when owner is signed in' do + context "when owner is signed in" do let(:user) { owner } before do allow(view).to receive(:can?).with(owner, :take_ownership_pipeline_schedule, pipeline_schedule).and_return(false) end - it 'owner cannot take ownership of pipeline' do + it "owner cannot take ownership of pipeline" do render - expect(rendered).not_to have_link('Take ownership') + expect(rendered).not_to have_link("Take ownership") end end end diff --git a/spec/views/projects/pipelines/_stage.html.haml_spec.rb b/spec/views/projects/pipelines/_stage.html.haml_spec.rb index e40e16e742b..120ee79ab12 100644 --- a/spec/views/projects/pipelines/_stage.html.haml_spec.rb +++ b/spec/views/projects/pipelines/_stage.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/pipelines/_stage' do +describe "projects/pipelines/_stage" do let(:project) { create(:project, :repository) } let(:pipeline) { create(:ci_pipeline, project: project) } let(:stage) { build(:ci_stage, pipeline: pipeline) } @@ -9,55 +9,55 @@ describe 'projects/pipelines/_stage' do assign :stage, stage end - context 'when there are only latest builds present' do + context "when there are only latest builds present" do before do - create(:ci_build, name: 'test:build', + create(:ci_build, name: "test:build", stage: stage.name, pipeline: pipeline) end - it 'shows the builds in the stage' do + it "shows the builds in the stage" do render - expect(rendered).to have_text 'test:build' + expect(rendered).to have_text "test:build" end end - context 'when build belongs to different stage' do + context "when build belongs to different stage" do before do - create(:ci_build, name: 'test:build', - stage: 'other:stage', + create(:ci_build, name: "test:build", + stage: "other:stage", pipeline: pipeline) end - it 'does not render build' do + it "does not render build" do render - expect(rendered).not_to have_text 'test:build' + expect(rendered).not_to have_text "test:build" end end - context 'when there are retried builds present' do + context "when there are retried builds present" do before do - create(:ci_build, name: 'test:build', stage: stage.name, pipeline: pipeline, retried: true) - create(:ci_build, name: 'test:build', stage: stage.name, pipeline: pipeline) + create(:ci_build, name: "test:build", stage: stage.name, pipeline: pipeline, retried: true) + create(:ci_build, name: "test:build", stage: stage.name, pipeline: pipeline) end - it 'shows only latest builds' do + it "shows only latest builds" do render - expect(rendered).to have_text 'test:build', count: 1 + expect(rendered).to have_text "test:build", count: 1 end end - context 'when there are multiple builds' do + context "when there are multiple builds" do before do HasStatus::AVAILABLE_STATUSES.each do |status| create_build(status) end end - it 'shows them in order' do + it "shows them in order" do render expect(rendered).to have_text(HasStatus::ORDERED_STATUSES.join(" ")) diff --git a/spec/views/projects/services/_form.haml_spec.rb b/spec/views/projects/services/_form.haml_spec.rb index 85167bca115..712142bd093 100644 --- a/spec/views/projects/services/_form.haml_spec.rb +++ b/spec/views/projects/services/_form.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/services/_form' do +describe "projects/services/_form" do let(:project) { create(:redmine_project) } let(:user) { create(:admin) } @@ -14,32 +14,32 @@ describe 'projects/services/_form' do current_application_settings: Gitlab::CurrentSettings.current_application_settings) end - context 'commit_events and merge_request_events' do + context "commit_events and merge_request_events" do before do assign(:service, project.redmine_service) end - it 'display merge_request_events and commit_events descriptions' do - allow(RedmineService).to receive(:supported_events).and_return(%w(commit merge_request)) + it "display merge_request_events and commit_events descriptions" do + allow(RedmineService).to receive(:supported_events).and_return(%w[commit merge_request]) render - expect(rendered).to have_content('Event will be triggered when a commit is created/updated') - expect(rendered).to have_content('Event will be triggered when a merge request is created/updated/merged') + expect(rendered).to have_content("Event will be triggered when a commit is created/updated") + expect(rendered).to have_content("Event will be triggered when a merge request is created/updated/merged") end - context 'when service is JIRA' do + context "when service is JIRA" do let(:project) { create(:jira_project) } before do assign(:service, project.jira_service) end - it 'display merge_request_events and commit_events descriptions' do + it "display merge_request_events and commit_events descriptions" do render - expect(rendered).to have_content('JIRA comments will be created when an issue gets referenced in a commit.') - expect(rendered).to have_content('JIRA comments will be created when an issue gets referenced in a merge request.') + expect(rendered).to have_content("JIRA comments will be created when an issue gets referenced in a commit.") + expect(rendered).to have_content("JIRA comments will be created when an issue gets referenced in a merge request.") end end end diff --git a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb index 2a2539c80b5..2b69c7e866a 100644 --- a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb +++ b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb @@ -1,15 +1,15 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/settings/ci_cd/_autodevops_form' do +describe "projects/settings/ci_cd/_autodevops_form" do let(:project) { create(:project, :repository) } before do assign :project, project end - it 'shows a warning message about Kubernetes cluster' do + it "shows a warning message about Kubernetes cluster" do render - expect(rendered).to have_text('You must add a Kubernetes cluster integration to this project with a domain in order for your deployment strategy to work correctly.') + expect(rendered).to have_text("You must add a Kubernetes cluster integration to this project with a domain in order for your deployment strategy to work correctly.") end end diff --git a/spec/views/projects/settings/operations/show.html.haml_spec.rb b/spec/views/projects/settings/operations/show.html.haml_spec.rb index 8e34521c7c8..b4e129d8846 100644 --- a/spec/views/projects/settings/operations/show.html.haml_spec.rb +++ b/spec/views/projects/settings/operations/show.html.haml_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require 'spec_helper' -require 'rails_helper' +require "spec_helper" +require "rails_helper" -describe 'projects/settings/operations/show' do +describe "projects/settings/operations/show" do let(:project) { create(:project) } let(:user) { create(:user) } @@ -11,7 +11,7 @@ describe 'projects/settings/operations/show' do assign :project, project end - describe 'Operations > Error Tracking' do + describe "Operations > Error Tracking" do before do project.add_reporter(user) @@ -24,13 +24,13 @@ describe 'projects/settings/operations/show' do create(:project_error_tracking_setting, project: project) end - context 'Settings page ' do - it 'renders the Operations Settings page' do + context "Settings page " do + it "renders the Operations Settings page" do render - expect(rendered).to have_content _('Error Tracking') - expect(rendered).to have_content _('To link Sentry to GitLab, enter your Sentry URL and Auth Token') - expect(rendered).to have_content _('Active') + expect(rendered).to have_content _("Error Tracking") + expect(rendered).to have_content _("To link Sentry to GitLab, enter your Sentry URL and Auth Token") + expect(rendered).to have_content _("Active") end end end diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb index cb97d17988c..9c0bd264bea 100644 --- a/spec/views/projects/tags/index.html.haml_spec.rb +++ b/spec/views/projects/tags/index.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/tags/index' do +describe "projects/tags/index" do let(:project) { create(:project, :repository) } before do @@ -8,13 +8,13 @@ describe 'projects/tags/index' do assign(:repository, project.repository) assign(:tags, []) - allow(view).to receive(:current_ref).and_return('master') + allow(view).to receive(:current_ref).and_return("master") allow(view).to receive(:can?).and_return(false) end - it 'defaults sort dropdown toggle to last updated' do + it "defaults sort dropdown toggle to last updated" do render - expect(rendered).to have_button('Last updated') + expect(rendered).to have_button("Last updated") end end diff --git a/spec/views/projects/tree/_tree_row.html.haml_spec.rb b/spec/views/projects/tree/_tree_row.html.haml_spec.rb index 3353b7665e2..374babc0686 100644 --- a/spec/views/projects/tree/_tree_row.html.haml_spec.rb +++ b/spec/views/projects/tree/_tree_row.html.haml_spec.rb @@ -1,37 +1,37 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/tree/_tree_row' do +describe "projects/tree/_tree_row" do let(:project) { create(:project, :repository) } let(:repository) { project.repository } - let(:blob_item) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files/ruby').first } + let(:blob_item) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, "files/ruby").first } before do assign(:project, project) assign(:repository, repository) - assign(:id, File.join('master', '')) + assign(:id, File.join("master", "")) assign(:lfs_blob_ids, []) end - it 'renders blob item' do + it "renders blob item" do render_partial(blob_item) expect(rendered).to have_content(blob_item.name) - expect(rendered).not_to have_selector('.label-lfs', text: 'LFS') + expect(rendered).not_to have_selector(".label-lfs", text: "LFS") end - describe 'LFS blob' do + describe "LFS blob" do before do assign(:lfs_blob_ids, [blob_item].map(&:id)) render_partial(blob_item) end - it 'renders LFS badge' do - expect(rendered).to have_selector('.label-lfs', text: 'LFS') + it "renders LFS badge" do + expect(rendered).to have_selector(".label-lfs", text: "LFS") end end def render_partial(items) - render partial: 'projects/tree/tree_row', collection: [items].flatten + render partial: "projects/tree/tree_row", collection: [items].flatten end end diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb index 3b098320ad7..d4f9b7d4ddc 100644 --- a/spec/views/projects/tree/show.html.haml_spec.rb +++ b/spec/views/projects/tree/show.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'projects/tree/show' do +describe "projects/tree/show" do include Devise::Test::ControllerHelpers let(:project) { create(:project, :repository) } @@ -13,14 +13,14 @@ describe 'projects/tree/show' do allow(view).to receive(:can?).and_return(true) allow(view).to receive(:can_collaborate_with_project?).and_return(true) - allow(view).to receive_message_chain('user_access.can_push_to_branch?').and_return(true) + allow(view).to receive_message_chain("user_access.can_push_to_branch?").and_return(true) allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) end - context 'for branch names ending on .json' do - let(:ref) { 'ends-with.json' } + context "for branch names ending on .json" do + let(:ref) { "ends-with.json" } let(:commit) { repository.commit(ref) } - let(:path) { '' } + let(:path) { "" } let(:tree) { repository.tree(commit.id, path) } before do @@ -31,10 +31,10 @@ describe 'projects/tree/show' do assign(:tree, tree) end - it 'displays correctly' do + it "displays correctly" do render - expect(rendered).to have_css('.js-project-refs-dropdown .dropdown-toggle-text', text: ref) - expect(rendered).to have_css('.readme-holder') + expect(rendered).to have_css(".js-project-refs-dropdown .dropdown-toggle-text", text: ref) + expect(rendered).to have_css(".readme-holder") end end end diff --git a/spec/views/shared/milestones/_issuable.html.haml.rb b/spec/views/shared/milestones/_issuable.html.haml.rb index 0a3f877cae0..29bf915110f 100644 --- a/spec/views/shared/milestones/_issuable.html.haml.rb +++ b/spec/views/shared/milestones/_issuable.html.haml.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'shared/milestones/_issuable.html.haml' do +describe "shared/milestones/_issuable.html.haml" do let(:project) { create(:project) } let(:user) { create(:user) } let(:milestone) { create(:milestone, project: project) } @@ -11,9 +11,9 @@ describe 'shared/milestones/_issuable.html.haml' do assign(:milestone, milestone) end - it 'avatar links to issues page' do - render 'shared/milestones/issuable', issuable: issuable, show_project_name: true + it "avatar links to issues page" do + render "shared/milestones/issuable", issuable: issuable, show_project_name: true - expect(rendered).to have_css("a[href='#{project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id, state: 'all')}']") + expect(rendered).to have_css("a[href='#{project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id, state: "all")}']") end end diff --git a/spec/views/shared/milestones/_issuables.html.haml.rb b/spec/views/shared/milestones/_issuables.html.haml.rb index 4769d569548..3f41beebdae 100644 --- a/spec/views/shared/milestones/_issuables.html.haml.rb +++ b/spec/views/shared/milestones/_issuables.html.haml.rb @@ -1,32 +1,32 @@ -require 'spec_helper' +require "spec_helper" -describe 'shared/milestones/_issuables.html.haml' do +describe "shared/milestones/_issuables.html.haml" do let(:issuables_size) { 100 } before do allow(view).to receive_messages(title: nil, id: nil, show_project_name: nil, - show_full_project_name: nil, dom_class: '', + show_full_project_name: nil, dom_class: "", issuables: double(size: issuables_size).as_null_object) - stub_template 'shared/milestones/_issuable.html.haml' => '' + stub_template "shared/milestones/_issuable.html.haml" => "" end - it 'should show the issuables count if show_counter is true' do - render 'shared/milestones/issuables', show_counter: true - expect(rendered).to have_content('100') + it "should show the issuables count if show_counter is true" do + render "shared/milestones/issuables", show_counter: true + expect(rendered).to have_content("100") end - it 'should not show the issuables count if show_counter is false' do - render 'shared/milestones/issuables', show_counter: false - expect(rendered).not_to have_content('100') + it "should not show the issuables count if show_counter is false" do + render "shared/milestones/issuables", show_counter: false + expect(rendered).not_to have_content("100") end - describe 'a high issuables count' do + describe "a high issuables count" do let(:issuables_size) { 1000 } - it 'should show a delimited number if show_counter is true' do - render 'shared/milestones/issuables', show_counter: true - expect(rendered).to have_content('1,000') + it "should show a delimited number if show_counter is true" do + render "shared/milestones/issuables", show_counter: true + expect(rendered).to have_content("1,000") end end end diff --git a/spec/views/shared/milestones/_top.html.haml.rb b/spec/views/shared/milestones/_top.html.haml.rb index 516d81c87ac..f89d06f7baf 100644 --- a/spec/views/shared/milestones/_top.html.haml.rb +++ b/spec/views/shared/milestones/_top.html.haml.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'shared/milestones/_top.html.haml' do +describe "shared/milestones/_top.html.haml" do set(:group) { create(:group) } let(:project) { create(:project, group: group) } let(:milestone) { create(:milestone, project: project) } @@ -9,27 +9,27 @@ describe 'shared/milestones/_top.html.haml' do allow(milestone).to receive(:milestones) { [] } end - it 'renders a deprecation message for a legacy milestone' do + it "renders a deprecation message for a legacy milestone" do allow(milestone).to receive(:legacy_group_milestone?) { true } - render 'shared/milestones/top', milestone: milestone + render "shared/milestones/top", milestone: milestone - expect(rendered).to have_css('.milestone-deprecation-message') + expect(rendered).to have_css(".milestone-deprecation-message") end - it 'renders a deprecation message for a dashboard milestone' do + it "renders a deprecation message for a dashboard milestone" do allow(milestone).to receive(:dashboard_milestone?) { true } - render 'shared/milestones/top', milestone: milestone + render "shared/milestones/top", milestone: milestone - expect(rendered).to have_css('.milestone-deprecation-message') + expect(rendered).to have_css(".milestone-deprecation-message") end - it 'does not render a deprecation message for a non-legacy and non-dashboard milestone' do + it "does not render a deprecation message for a non-legacy and non-dashboard milestone" do assign :group, group - render 'shared/milestones/top', milestone: milestone + render "shared/milestones/top", milestone: milestone - expect(rendered).not_to have_css('.milestone-deprecation-message') + expect(rendered).not_to have_css(".milestone-deprecation-message") end end diff --git a/spec/views/shared/notes/_form.html.haml_spec.rb b/spec/views/shared/notes/_form.html.haml_spec.rb index 0189f926a5f..4a155f9f03d 100644 --- a/spec/views/shared/notes/_form.html.haml_spec.rb +++ b/spec/views/shared/notes/_form.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'shared/notes/_form' do +describe "shared/notes/_form" do include Devise::Test::ControllerHelpers let(:user) { create(:user) } @@ -20,8 +20,8 @@ describe 'shared/notes/_form' do context "with a note on #{noteable}" do let(:note) { build(:"note_on_#{noteable}", project: project) } - it 'says that markdown and quick actions are supported' do - expect(rendered).to have_content('Markdown and quick actions are supported') + it "says that markdown and quick actions are supported" do + expect(rendered).to have_content("Markdown and quick actions are supported") end end end diff --git a/spec/views/shared/projects/_project.html.haml_spec.rb b/spec/views/shared/projects/_project.html.haml_spec.rb index 3b14045e61f..c9f23b38261 100644 --- a/spec/views/shared/projects/_project.html.haml_spec.rb +++ b/spec/views/shared/projects/_project.html.haml_spec.rb @@ -1,6 +1,6 @@ -require 'spec_helper' +require "spec_helper" -describe 'shared/projects/_project.html.haml' do +describe "shared/projects/_project.html.haml" do let(:project) { create(:project) } before do @@ -8,17 +8,17 @@ describe 'shared/projects/_project.html.haml' do allow(view).to receive(:can?) { true } end - it 'should render creator avatar if project has a creator' do - render 'shared/projects/project', use_creator_avatar: true, project: project + it "should render creator avatar if project has a creator" do + render "shared/projects/project", use_creator_avatar: true, project: project - expect(rendered).to have_selector('img.avatar') + expect(rendered).to have_selector("img.avatar") end - it 'should render a generic avatar if project does not have a creator' do + it "should render a generic avatar if project does not have a creator" do project.creator = nil - render 'shared/projects/project', use_creator_avatar: true, project: project + render "shared/projects/project", use_creator_avatar: true, project: project - expect(rendered).to have_selector('.project-avatar') + expect(rendered).to have_selector(".project-avatar") end end diff --git a/spec/views/shared/runners/show.html.haml_spec.rb b/spec/views/shared/runners/show.html.haml_spec.rb index 5e92928b143..efbc2e5f098 100644 --- a/spec/views/shared/runners/show.html.haml_spec.rb +++ b/spec/views/shared/runners/show.html.haml_spec.rb @@ -1,16 +1,16 @@ # frozen_string_literal: true -require 'spec_helper' +require "spec_helper" -describe 'shared/runners/show.html.haml' do +describe "shared/runners/show.html.haml" do include PageLayoutHelper let(:runner) do - create(:ci_runner, name: 'test runner', - version: '11.4.0', - ip_address: '127.1.2.3', - revision: 'abcd1234', - architecture: 'amd64' ) + create(:ci_runner, name: "test runner", + version: "11.4.0", + ip_address: "127.1.2.3", + revision: "abcd1234", + architecture: "amd64") end before do @@ -22,109 +22,109 @@ describe 'shared/runners/show.html.haml' do rendered end - describe 'Page title' do + describe "Page title" do before do - expect_any_instance_of(PageLayoutHelper).to receive(:page_title).with("#{runner.description} ##{runner.id}", 'Runners') + expect_any_instance_of(PageLayoutHelper).to receive(:page_title).with("#{runner.description} ##{runner.id}", "Runners") end - it 'sets proper page title' do + it "sets proper page title" do render end end - describe 'Runner id and type' do - context 'when runner is of type instance' do + describe "Runner id and type" do + context "when runner is of type instance" do it { is_expected.to have_content("Runner ##{runner.id} Shared") } end - context 'when runner is of type group' do + context "when runner is of type group" do let(:runner) { create(:ci_runner, :group) } it { is_expected.to have_content("Runner ##{runner.id} Group") } end - context 'when runner is of type project' do + context "when runner is of type project" do let(:runner) { create(:ci_runner, :project) } it { is_expected.to have_content("Runner ##{runner.id} Specific") } end end - describe 'Active value' do - context 'when runner is active' do - it { is_expected.to have_content('Active Yes') } + describe "Active value" do + context "when runner is active" do + it { is_expected.to have_content("Active Yes") } end - context 'when runner is inactive' do + context "when runner is inactive" do let(:runner) { create(:ci_runner, :inactive) } - it { is_expected.to have_content('Active No') } + it { is_expected.to have_content("Active No") } end end - describe 'Protected value' do - context 'when runner is not protected' do - it { is_expected.to have_content('Protected No') } + describe "Protected value" do + context "when runner is not protected" do + it { is_expected.to have_content("Protected No") } end - context 'when runner is protected' do + context "when runner is protected" do let(:runner) { create(:ci_runner, :ref_protected) } - it { is_expected.to have_content('Protected Yes') } + it { is_expected.to have_content("Protected Yes") } end end - describe 'Can run untagged jobs value' do - context 'when runner run untagged job is set' do - it { is_expected.to have_content('Can run untagged jobs Yes') } + describe "Can run untagged jobs value" do + context "when runner run untagged job is set" do + it { is_expected.to have_content("Can run untagged jobs Yes") } end - context 'when runner run untagged job is unset' do + context "when runner run untagged job is unset" do let(:runner) { create(:ci_runner, :tagged_only) } - it { is_expected.to have_content('Can run untagged jobs No') } + it { is_expected.to have_content("Can run untagged jobs No") } end end - describe 'Locked to this project value' do - context 'when runner locked is not set' do - it { is_expected.to have_content('Locked to this project No') } + describe "Locked to this project value" do + context "when runner locked is not set" do + it { is_expected.to have_content("Locked to this project No") } - context 'when runner is of type group' do + context "when runner is of type group" do let(:runner) { create(:ci_runner, :group) } - it { is_expected.not_to have_content('Locked to this project') } + it { is_expected.not_to have_content("Locked to this project") } end end - context 'when runner locked is set' do + context "when runner locked is set" do let(:runner) { create(:ci_runner, :locked) } - it { is_expected.to have_content('Locked to this project Yes') } + it { is_expected.to have_content("Locked to this project Yes") } - context 'when runner is of type group' do + context "when runner is of type group" do let(:runner) { create(:ci_runner, :group, :locked) } - it { is_expected.not_to have_content('Locked to this project') } + it { is_expected.not_to have_content("Locked to this project") } end end end - describe 'Tags value' do - context 'when runner does not have tags' do - it { is_expected.to have_content('Tags') } - it { is_expected.not_to have_selector('span.badge.badge-primary')} + describe "Tags value" do + context "when runner does not have tags" do + it { is_expected.to have_content("Tags") } + it { is_expected.not_to have_selector("span.badge.badge-primary")} end - context 'when runner have tags' do - let(:runner) { create(:ci_runner, tag_list: %w(tag2 tag3 tag1)) } + context "when runner have tags" do + let(:runner) { create(:ci_runner, tag_list: %w[tag2 tag3 tag1]) } - it { is_expected.to have_content('Tags tag1 tag2 tag3') } - it { is_expected.to have_selector('span.badge.badge-primary')} + it { is_expected.to have_content("Tags tag1 tag2 tag3") } + it { is_expected.to have_selector("span.badge.badge-primary")} end end - describe 'Metadata values' do + describe "Metadata values" do it { is_expected.to have_content("Name #{runner.name}") } it { is_expected.to have_content("Version #{runner.version}") } it { is_expected.to have_content("IP Address #{runner.ip_address}") } @@ -134,18 +134,18 @@ describe 'shared/runners/show.html.haml' do it { is_expected.to have_content("Description #{runner.description}") } end - describe 'Maximum job timeout value' do + describe "Maximum job timeout value" do let(:runner) { create(:ci_runner, maximum_timeout: 5400) } - it { is_expected.to have_content('Maximum job timeout 1h 30m') } + it { is_expected.to have_content("Maximum job timeout 1h 30m") } end - describe 'Last contact value' do - context 'when runner have not contacted yet' do - it { is_expected.to have_content('Last contact Never') } + describe "Last contact value" do + context "when runner have not contacted yet" do + it { is_expected.to have_content("Last contact Never") } end - context 'when runner have already contacted' do + context "when runner have already contacted" do let(:runner) { create(:ci_runner, contacted_at: DateTime.now - 6.days) } let(:expected_contacted_at) { I18n.localize(runner.contacted_at, format: "%b %d, %Y") } |