diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-25 06:11:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-25 06:11:36 +0300 |
commit | a85b67d51ad8895284babce73736437f9f41304b (patch) | |
tree | 2c10b0b635edac30f03aa6bd5cafba7750984c82 /spec | |
parent | e4d18499293fbc9510a87611acb7d9787a581b78 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/admin/admin_hooks_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/admin/admin_mode/logout_spec.rb | 15 | ||||
-rw-r--r-- | spec/features/admin/admin_mode/workers_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/admin/admin_mode_spec.rb | 47 | ||||
-rw-r--r-- | spec/features/admin/admin_sees_background_migrations_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/admin/users/user_spec.rb | 22 | ||||
-rw-r--r-- | spec/features/commits_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/dashboard/projects_spec.rb | 4 | ||||
-rw-r--r-- | spec/fixtures/api/schemas/entities/member.json | 34 | ||||
-rw-r--r-- | spec/helpers/ci/status_helper_spec.rb | 86 | ||||
-rw-r--r-- | spec/migrations/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2_spec.rb | 37 | ||||
-rw-r--r-- | spec/support/helpers/login_helpers.rb | 15 | ||||
-rw-r--r-- | spec/views/ci/status/_badge.html.haml_spec.rb | 92 | ||||
-rw-r--r-- | spec/views/projects/commits/_commit.html.haml_spec.rb | 6 | ||||
-rw-r--r-- | spec/views/projects/issues/_related_branches.html.haml_spec.rb | 1 |
16 files changed, 174 insertions, 229 deletions
diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index a5acba1fe4a..2aec5baf351 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'Admin::Hooks', feature_category: :webhooks do include Spec::Support::Helpers::ModalHelpers - let_it_be(:user) { create(:admin, :no_super_sidebar) } + let_it_be(:user) { create(:admin) } before do sign_in(user) @@ -13,10 +13,10 @@ RSpec.describe 'Admin::Hooks', feature_category: :webhooks do end describe 'GET /admin/hooks' do - it 'is ok' do + it 'is ok', :js do visit admin_root_path - page.within '.nav-sidebar' do + within_testid('super-sidebar') do click_on 'System Hooks', match: :first end diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb index 5d9106fea02..7a33256e7a8 100644 --- a/spec/features/admin/admin_mode/logout_spec.rb +++ b/spec/features/admin/admin_mode/logout_spec.rb @@ -5,9 +5,8 @@ require 'spec_helper' RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do include TermsHelper include UserLoginHelper - include Features::TopNavSpecHelpers - let(:user) { create(:admin, :no_super_sidebar) } + let(:user) { create(:admin) } before do # TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See @@ -22,11 +21,9 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do expect(page).to have_current_path root_path, ignore_query: true - open_top_nav + click_button 'Search or go to…' - within_top_nav do - expect(page).to have_link(href: new_admin_session_path) - end + expect(page).to have_link(href: new_admin_session_path) end it 'disable shows flash notice' do @@ -45,11 +42,9 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do expect(page).to have_current_path root_path, ignore_query: true - open_top_nav + click_button 'Search or go to…' - within_top_nav do - expect(page).to have_link(href: new_admin_session_path) - end + expect(page).to have_link(href: new_admin_session_path) end end end diff --git a/spec/features/admin/admin_mode/workers_spec.rb b/spec/features/admin/admin_mode/workers_spec.rb index 2a862c750d7..124c43eef9d 100644 --- a/spec/features/admin/admin_mode/workers_spec.rb +++ b/spec/features/admin/admin_mode/workers_spec.rb @@ -6,8 +6,8 @@ require 'spec_helper' RSpec.describe 'Admin mode for workers', :request_store, feature_category: :system_access do include Features::AdminUsersHelpers - let(:user) { create(:user, :no_super_sidebar) } - let(:user_to_delete) { create(:user, :no_super_sidebar) } + let(:user) { create(:user) } + let(:user_to_delete) { create(:user) } before do sign_in(user) @@ -22,7 +22,7 @@ RSpec.describe 'Admin mode for workers', :request_store, feature_category: :syst end context 'as an admin user' do - let(:user) { create(:admin, :no_super_sidebar) } + let(:user) { create(:admin) } context 'when admin mode disabled' do it 'cannot delete user', :js do diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb index edfa58567ad..b1b44ce143f 100644 --- a/spec/features/admin/admin_mode_spec.rb +++ b/spec/features/admin/admin_mode_spec.rb @@ -4,10 +4,9 @@ require 'spec_helper' RSpec.describe 'Admin mode', :js, feature_category: :shared do include MobileHelpers - include Features::TopNavSpecHelpers include StubENV - let(:admin) { create(:admin, :no_super_sidebar) } + let(:admin) { create(:admin) } before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') @@ -21,20 +20,16 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do context 'when not in admin mode' do it 'has no leave admin mode button' do visit new_admin_session_path - open_top_nav + open_search_modal - page.within('.navbar-sub-nav') do - expect(page).not_to have_link(href: destroy_admin_session_path) - end + expect(page).not_to have_link(href: destroy_admin_session_path) end it 'can open pages not in admin scope' do visit new_admin_session_path - open_top_nav_projects + open_search_modal - within_top_nav do - click_link('View all projects') - end + click_link('View all my projects') expect(page).to have_current_path(dashboard_projects_path) end @@ -78,29 +73,23 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do end it 'contains link to leave admin mode' do - open_top_nav + open_search_modal - within_top_nav do - expect(page).to have_link(href: destroy_admin_session_path) - end + expect(page).to have_link(href: destroy_admin_session_path) end it 'can leave admin mode using main dashboard link' do gitlab_disable_admin_mode - open_top_nav + open_search_modal - within_top_nav do - expect(page).to have_link(href: new_admin_session_path) - end + expect(page).to have_link(href: new_admin_session_path) end it 'can open pages not in admin scope' do - open_top_nav_projects + open_search_modal - within_top_nav do - click_link('View all projects') - end + click_link('View all my projects') expect(page).to have_current_path(dashboard_projects_path) end @@ -108,7 +97,7 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do context 'nav bar' do it 'shows admin dashboard links on bigger screen' do visit root_dashboard_path - open_top_nav + open_search_modal expect(page).to have_link(text: 'Admin', href: admin_root_path, visible: true) expect(page).to have_link(text: 'Leave admin mode', href: destroy_admin_session_path, visible: true) @@ -123,11 +112,9 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do it 'can leave admin mode' do gitlab_disable_admin_mode - open_top_nav + open_search_modal - within_top_nav do - expect(page).to have_link(href: new_admin_session_path) - end + expect(page).to have_link(href: new_admin_session_path) end end end @@ -141,10 +128,14 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do it 'shows no admin mode buttons in navbar' do visit admin_root_path - open_top_nav + open_search_modal expect(page).not_to have_link(href: new_admin_session_path) expect(page).not_to have_link(href: destroy_admin_session_path) end end + + def open_search_modal + click_button 'Search or go to…' + end end diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb index 7423e74bf3a..ae307b8038c 100644 --- a/spec/features/admin/admin_sees_background_migrations_spec.rb +++ b/spec/features/admin/admin_sees_background_migrations_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe "Admin > Admin sees background migrations", feature_category: :database do include ListboxHelpers - let_it_be(:admin) { create(:admin, :no_super_sidebar) } + let_it_be(:admin) { create(:admin) } let(:job_class) { Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJob } let_it_be(:active_migration) { create(:batched_background_migration, :active, table_name: 'active') } @@ -21,16 +21,18 @@ RSpec.describe "Admin > Admin sees background migrations", feature_category: :da gitlab_enable_admin_mode_sign_in(admin) end - it 'can navigate to background migrations' do + it 'can navigate to background migrations', :js do visit admin_root_path - within '.nav-sidebar' do - link = find_link 'Background Migrations' + within_testid('super-sidebar') do + click_on 'Monitoring' + click_on 'Background Migrations' + end - link.click + expect(page).to have_current_path(admin_background_migrations_path) - expect(page).to have_current_path(admin_background_migrations_path) - expect(link).to have_ancestor(:css, 'li.active') + within_testid('super-sidebar') do + expect(page).to have_css('a[aria-current="page"]', text: 'Background Migrations') end end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index aae41cab21f..dbdc0a03404 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do include TermsHelper include UsageDataHelpers - let_it_be(:admin) { create(:admin, :no_super_sidebar) } + let_it_be(:admin) { create(:admin) } context 'application setting :admin_mode is enabled', :request_store do before do @@ -990,15 +990,14 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do end end - context 'Nav bar' do + context 'Nav bar', :js do it 'shows default help links in nav' do default_support_url = "https://#{ApplicationHelper.promo_host}/get-help/" visit root_dashboard_path - find('.header-help-dropdown-toggle').click - - page.within '.header-help' do + within_testid('super-sidebar') do + click_on 'Help' expect(page).to have_link(text: 'Help', href: help_path) expect(page).to have_link(text: 'Support', href: default_support_url) end @@ -1010,9 +1009,8 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do visit root_dashboard_path - find('.header-help-dropdown-toggle').click - - page.within '.header-help' do + within_testid('super-sidebar') do + click_on 'Help' expect(page).to have_link(text: 'Support', href: new_support_url) end end diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index 7dc329e6909..fbf11063f7c 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -6,8 +6,8 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do include Features::AdminUsersHelpers include Spec::Support::Helpers::ModalHelpers - let_it_be(:user) { create(:omniauth_user, :no_super_sidebar, provider: 'twitter', extern_uid: '123456') } - let_it_be(:current_user) { create(:admin, :no_super_sidebar) } + let_it_be(:user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') } + let_it_be(:current_user) { create(:admin) } before do sign_in(current_user) @@ -145,7 +145,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do end describe 'Impersonation' do - let_it_be(:another_user) { create(:user, :no_super_sidebar) } + let_it_be(:another_user) { create(:user) } context 'before impersonating' do subject { visit admin_user_path(user_to_visit) } @@ -257,15 +257,13 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do visit admin_user_path(another_user) end - it 'logs in as the user when impersonate is clicked' do + it 'logs in as the user when impersonate is clicked', :js do subject - find('[data-testid="user-dropdown"]').click - - expect(page.find(:css, '[data-testid="user-profile-link"]')['data-user']).to eql(another_user.username) + expect(page).to have_button("#{another_user.name} user’s menu") end - it 'sees impersonation log out icon' do + it 'sees impersonation log out icon', :js do subject icon = first('[data-testid="incognito-icon"]') @@ -306,8 +304,8 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do end end - context 'ending impersonation' do - subject { find(:css, 'li.impersonation a').click } + context 'ending impersonation', :js do + subject { click_on 'Stop impersonating' } before do visit admin_user_path(another_user) @@ -317,9 +315,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do it 'logs out of impersonated user back to original user' do subject - find('[data-testid="user-dropdown"]').click - - expect(page.find(:css, '[data-testid="user-profile-link"]')['data-user']).to eq(current_user.username) + expect(page).to have_button("#{current_user.name} user’s menu") end it 'is redirected back to the impersonated users page in the admin after stopping' do diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 5f880af37dc..1df1b7373d9 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -81,7 +81,7 @@ RSpec.describe 'Commits', feature_category: :source_code_management do it 'shows correct build status from default branch' do page.within("//li[@id='commit-#{pipeline.short_sha}']") do - expect(page).to have_css("[data-testid='ci-status-badge-legacy']") + expect(page).to have_css("[data-testid='ci-icon']") expect(page).to have_css('.ci-status-icon-success') end end diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 90ad6fcea25..65436b35cd7 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -153,7 +153,7 @@ RSpec.describe 'Dashboard Projects', feature_category: :groups_and_projects do page.within('[data-testid="project_controls"]') do expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']") - expect(page).to have_css("[data-testid='ci-status-badge']") + expect(page).to have_css("[data-testid='ci-icon']") expect(page).to have_css('.ci-status-icon-success') expect(page).to have_link('Pipeline: passed') end @@ -165,7 +165,7 @@ RSpec.describe 'Dashboard Projects', feature_category: :groups_and_projects do page.within('[data-testid="project_controls"]') do expect(page).not_to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']") - expect(page).not_to have_css("[data-testid='ci-status-badge']") + expect(page).not_to have_css("[data-testid='ci-icon']") expect(page).not_to have_css('.ci-status-icon-success') expect(page).not_to have_link('Pipeline: passed') end diff --git a/spec/fixtures/api/schemas/entities/member.json b/spec/fixtures/api/schemas/entities/member.json index cd8a4e0519b..38f8a245b49 100644 --- a/spec/fixtures/api/schemas/entities/member.json +++ b/spec/fixtures/api/schemas/entities/member.json @@ -11,7 +11,8 @@ "type", "can_update", "can_remove", - "is_direct_member" + "is_direct_member", + "custom_roles" ], "properties": { "id": { @@ -48,7 +49,8 @@ "type": "object", "required": [ "integer_value", - "string_value" + "string_value", + "member_role_id" ], "properties": { "integer_value": { @@ -56,6 +58,12 @@ }, "string_value": { "type": "string" + }, + "member_role_id": { + "type": [ + "integer", + "null" + ] } }, "additionalProperties": false @@ -138,6 +146,26 @@ } }, "additionalProperties": false + }, + "custom_roles": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "base_access_level": { + "type": "integer" + }, + "member_role_id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ] } } -}
\ No newline at end of file +} diff --git a/spec/helpers/ci/status_helper_spec.rb b/spec/helpers/ci/status_helper_spec.rb index dc56ec96e3b..18983c83262 100644 --- a/spec/helpers/ci/status_helper_spec.rb +++ b/spec/helpers/ci/status_helper_spec.rb @@ -8,18 +8,6 @@ RSpec.describe Ci::StatusHelper do let(:success_commit) { double("Ci::Pipeline", status: 'success') } let(:failed_commit) { double("Ci::Pipeline", status: 'failed') } - describe '#ci_icon_for_status' do - it 'renders to correct svg on success' do - expect(helper.ci_icon_for_status('success').to_s) - .to include 'status_success' - end - - it 'renders the correct svg on failure' do - expect(helper.ci_icon_for_status('failed').to_s) - .to include 'status_failed' - end - end - describe "#pipeline_status_cache_key" do it "builds a cache key for pipeline status" do pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new( @@ -33,12 +21,8 @@ RSpec.describe Ci::StatusHelper do end end - describe "#render_status_with_link" do - subject { helper.render_status_with_link("success") } - - it "renders a passed status icon" do - is_expected.to include("<span class=\"js-ci-status-badge-legacy ci-status-icon-success d-inline-flex") - end + describe "#render_ci_icon" do + subject { helper.render_ci_icon("success") } it "has 'Pipeline' as the status type in the title" do is_expected.to include("title=\"Pipeline: passed\"") @@ -49,7 +33,7 @@ RSpec.describe Ci::StatusHelper do end context "when pipeline has commit path" do - subject { helper.render_status_with_link("success", "/commit-path") } + subject { helper.render_ci_icon("success", "/commit-path") } it "links to commit" do is_expected.to include("href=\"/commit-path\"") @@ -64,49 +48,24 @@ RSpec.describe Ci::StatusHelper do end end - context "when different type than pipeline is provided" do - subject { helper.render_status_with_link("success", type: "commit") } - - it "has the provided type in the title" do - is_expected.to include("title=\"Commit: passed\"") - end - end - context "when tooltip_placement is provided" do - subject { helper.render_status_with_link("success", tooltip_placement: "right") } + subject { helper.render_ci_icon("success", tooltip_placement: "right") } it "has the provided tooltip placement" do is_expected.to include("data-placement=\"right\"") end end - context "when additional CSS classes are provided" do - subject { helper.render_status_with_link("success", cssclass: "extra-class") } - - it "has appended extra class to icon classes" do - is_expected.to include('class="js-ci-status-badge-legacy ci-status-icon-success d-inline-flex ' \ - 'gl-line-height-1 extra-class"') - end - end - context "when container is provided" do - subject { helper.render_status_with_link("success", container: "my-container") } + subject { helper.render_ci_icon("success", container: "my-container") } it "has the provided container in data" do is_expected.to include("data-container=\"my-container\"") end end - context "when icon_size is provided" do - subject { helper.render_status_with_link("success", icon_size: 24) } - - it "has the svg class to change size" do - is_expected.to include("<svg class=\"s24\"") - end - end - context "when status is success-with-warnings" do - subject { helper.render_status_with_link("success-with-warnings") } + subject { helper.render_ci_icon("success-with-warnings") } it "renders warning variant of gl-badge" do is_expected.to include('gl-badge badge badge-pill badge-warning') @@ -114,7 +73,7 @@ RSpec.describe Ci::StatusHelper do end context "when status is manual" do - subject { helper.render_status_with_link("manual") } + subject { helper.render_ci_icon("manual") } it "renders neutral variant of gl-badge" do is_expected.to include('gl-badge badge badge-pill badge-neutral') @@ -137,11 +96,40 @@ RSpec.describe Ci::StatusHelper do end with_them do - subject { helper.render_status_with_link(status) } + subject { helper.render_ci_icon(status) } it 'uses the correct badge variant classes for gl-badge' do is_expected.to include("gl-badge badge badge-pill #{expected_badge_variant_class}") end end end + + describe '#ci_icon_for_status' do + using RSpec::Parameterized::TableSyntax + + where(:status, :icon_variant) do + 'success' | 'status_success' + 'success-with-warnings' | 'status_warning' + 'preparing' | 'status_preparing' + 'pending' | 'status_pending' + 'waiting-for-resource' | 'status_pending' + 'failed' | 'status_failed' + 'running' | 'status_running' + 'canceled' | 'status_canceled' + 'created' | 'status_created' + 'scheduled' | 'status_scheduled' + 'play' | 'play' + 'skipped' | 'status_skipped' + 'manual' | 'status_manual' + end + + with_them do + subject { helper.render_ci_icon(status).to_s } + + it 'uses the correct icon variant for status' do + is_expected.to include("ci-status-icon-#{status}") + is_expected.to include(icon_variant) + end + end + end end diff --git a/spec/migrations/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2_spec.rb b/spec/migrations/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2_spec.rb new file mode 100644 index 00000000000..266786dda3a --- /dev/null +++ b/spec/migrations/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe SwapColumnsForCiStagesPipelineIdBigintV2, feature_category: :continuous_integration do + context 'when pipeline_id sql type is integer' do + before do + active_record_base.connection.execute(<<~SQL) + ALTER TABLE ci_stages ALTER COLUMN pipeline_id TYPE integer; + ALTER TABLE ci_stages ALTER COLUMN pipeline_id_convert_to_bigint TYPE bigint; + SQL + end + + it_behaves_like( + 'swap conversion columns', + table_name: :ci_stages, + from: :pipeline_id, + to: :pipeline_id_convert_to_bigint + ) + end + + context 'when pipeline_id sql type is bigint' do + before do + active_record_base.connection.execute(<<~SQL) + ALTER TABLE ci_stages ALTER COLUMN pipeline_id TYPE bigint; + ALTER TABLE ci_stages ALTER COLUMN pipeline_id_convert_to_bigint TYPE integer; + SQL + end + + it 'does nothing' do + recorder = ActiveRecord::QueryRecorder.new { migrate! } + expect(recorder.log).not_to include(/LOCK TABLE/) + expect(recorder.log).not_to include(/ALTER TABLE/) + end + end +end diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index abe21d2b74c..873e4722c14 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -70,7 +70,13 @@ module LoginHelpers # Requires Javascript driver. def gitlab_sign_out - find(".header-user-dropdown-toggle").click + if has_testid?('super-sidebar') + click_on "#{@current_user.name} user’s menu" + else + # This can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/420121 is complete. + find(".header-user-dropdown-toggle").click + end + click_link "Sign out" @current_user = nil @@ -79,11 +85,8 @@ module LoginHelpers # Requires Javascript driver. def gitlab_disable_admin_mode - open_top_nav - - within_top_nav do - click_on 'Leave admin mode' - end + click_on 'Search or go to…' + click_on 'Leave admin mode' end private diff --git a/spec/views/ci/status/_badge.html.haml_spec.rb b/spec/views/ci/status/_badge.html.haml_spec.rb deleted file mode 100644 index 65497de1608..00000000000 --- a/spec/views/ci/status/_badge.html.haml_spec.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.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 - let(:build) do - create(:ci_build, :success, pipeline: pipeline) - end - - context 'when user has ability to see details' do - before do - project.add_developer(user) - end - - 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 - end - end - - 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' - end - - 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 - before do - project.add_developer(user) - end - - context 'status has external target url' do - before do - external_job = create( - :generic_commit_status, - 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' - end - - 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 - 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' - end - - 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) - end -end diff --git a/spec/views/projects/commits/_commit.html.haml_spec.rb b/spec/views/projects/commits/_commit.html.haml_spec.rb index d45f1da86e8..cc73418ea1e 100644 --- a/spec/views/projects/commits/_commit.html.haml_spec.rb +++ b/spec/views/projects/commits/_commit.html.haml_spec.rb @@ -74,7 +74,7 @@ RSpec.describe 'projects/commits/_commit.html.haml' do commit: commit } - expect(rendered).not_to have_css("[data-testid='ci-status-badge-legacy']") + expect(rendered).not_to have_css("[data-testid='ci-icon']") end end @@ -91,7 +91,7 @@ RSpec.describe 'projects/commits/_commit.html.haml' do commit: commit } - expect(rendered).to have_css("[data-testid='ci-status-badge-legacy']") + expect(rendered).to have_css("[data-testid='ci-icon']") end end @@ -103,7 +103,7 @@ RSpec.describe 'projects/commits/_commit.html.haml' do commit: commit } - expect(rendered).not_to have_css("[data-testid='ci-status-badge-legacy']") + expect(rendered).not_to have_css("[data-testid='ci-icon']") end end 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 deec2db6865..11c398f4e3b 100644 --- a/spec/views/projects/issues/_related_branches.html.haml_spec.rb +++ b/spec/views/projects/issues/_related_branches.html.haml_spec.rb @@ -25,7 +25,6 @@ RSpec.describe 'projects/issues/_related_branches' do expect(rendered).to have_text('other') expect(rendered).to have_link(href: 'link-to-feature') expect(rendered).to have_link(href: 'link-to-other') - expect(rendered).to have_css('.related-branch-ci-status') expect(rendered).to have_css('.ci-status-icon') expect(rendered).to have_css('.related-branch-info') end |