diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-06 21:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-06 21:08:09 +0300 |
commit | 1287690a3678ad0ec21c9b2f3b21ae18257d5e22 (patch) | |
tree | 96162972275004dcaef6376fe324ee2a7a549833 /spec | |
parent | d4806ad7dbd2d87ae09872709fef1aef35792e21 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/registrations/welcome_controller_spec.rb | 5 | ||||
-rw-r--r-- | spec/features/users/signup_spec.rb | 1 | ||||
-rw-r--r-- | spec/frontend/awards_handler_spec.js | 4 | ||||
-rw-r--r-- | spec/frontend/releases/__snapshots__/util_spec.js.snap | 12 | ||||
-rw-r--r-- | spec/frontend/releases/components/evidence_block_spec.js | 6 | ||||
-rw-r--r-- | spec/frontend/releases/util_spec.js | 16 | ||||
-rw-r--r-- | spec/models/diff_viewer/server_side_spec.rb | 26 | ||||
-rw-r--r-- | spec/support/database/prevent_cross_database_modification.rb | 6 | ||||
-rw-r--r-- | spec/tooling/danger/config_files_spec.rb | 2 |
9 files changed, 56 insertions, 22 deletions
diff --git a/spec/controllers/registrations/welcome_controller_spec.rb b/spec/controllers/registrations/welcome_controller_spec.rb index 14e88d469ba..a3b246fbedd 100644 --- a/spec/controllers/registrations/welcome_controller_spec.rb +++ b/spec/controllers/registrations/welcome_controller_spec.rb @@ -31,7 +31,6 @@ RSpec.describe Registrations::WelcomeController do context 'when role and setup_for_company is set' do before do - stub_feature_flags(about_your_company_registration_flow: false) user.update!(setup_for_company: false) sign_in(user) end @@ -61,10 +60,6 @@ RSpec.describe Registrations::WelcomeController do end describe '#update' do - before do - stub_feature_flags(about_your_company_registration_flow: false) - end - subject(:update) do patch :update, params: { user: { role: 'software_developer', setup_for_company: 'false' } } end diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb index de53e722603..9b1a102f07b 100644 --- a/spec/features/users/signup_spec.rb +++ b/spec/features/users/signup_spec.rb @@ -349,7 +349,6 @@ RSpec.describe 'Signup' do end it 'redirects to step 2 of the signup process, sets the role and redirects back' do - stub_feature_flags(about_your_company_registration_flow: false) visit new_user_registration_path fill_in_signup_form diff --git a/spec/frontend/awards_handler_spec.js b/spec/frontend/awards_handler_spec.js index b14bc5122b9..1a54b9909ba 100644 --- a/spec/frontend/awards_handler_spec.js +++ b/spec/frontend/awards_handler_spec.js @@ -185,7 +185,9 @@ describe('AwardsHandler', () => { describe('::getAwardUrl', () => { it('returns the url for request', () => { - expect(awardsHandler.getAwardUrl()).toBe('http://test.host/-/snippets/1/toggle_award_emoji'); + expect(awardsHandler.getAwardUrl()).toBe( + document.querySelector('.js-awards-block').dataset.awardUrl, + ); }); }); diff --git a/spec/frontend/releases/__snapshots__/util_spec.js.snap b/spec/frontend/releases/__snapshots__/util_spec.js.snap index 55e3dda60a0..d88d79d2cde 100644 --- a/spec/frontend/releases/__snapshots__/util_spec.js.snap +++ b/spec/frontend/releases/__snapshots__/util_spec.js.snap @@ -155,8 +155,8 @@ Object { Object { "__typename": "ReleaseEvidence", "collectedAt": "2018-12-03T00:00:00Z", - "filepath": "http://localhost/releases-namespace/releases-project/-/releases/v1.1/evidences/1.json", - "id": "gid://gitlab/Releases::Evidence/1", + "filepath": Any<String>, + "id": Any<String>, "sha": "760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d", }, ], @@ -198,10 +198,10 @@ Object { ], "paginationInfo": Object { "__typename": "PageInfo", - "endCursor": "eyJyZWxlYXNlZF9hdCI6IjIwMTgtMTItMTAgMDA6MDA6MDAuMDAwMDAwMDAwICswMDAwIiwiaWQiOiIxIn0", + "endCursor": Any<String>, "hasNextPage": false, "hasPreviousPage": false, - "startCursor": "eyJyZWxlYXNlZF9hdCI6IjIwMTktMDEtMTAgMDA6MDA6MDAuMDAwMDAwMDAwICswMDAwIiwiaWQiOiIyIn0", + "startCursor": Any<String>, }, } `; @@ -377,8 +377,8 @@ Object { Object { "__typename": "ReleaseEvidence", "collectedAt": "2018-12-03T00:00:00Z", - "filepath": "http://localhost/releases-namespace/releases-project/-/releases/v1.1/evidences/1.json", - "id": "gid://gitlab/Releases::Evidence/1", + "filepath": Any<String>, + "id": Any<String>, "sha": "760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d", }, ], diff --git a/spec/frontend/releases/components/evidence_block_spec.js b/spec/frontend/releases/components/evidence_block_spec.js index 2db1e9e38a2..6f935215dd7 100644 --- a/spec/frontend/releases/components/evidence_block_spec.js +++ b/spec/frontend/releases/components/evidence_block_spec.js @@ -36,7 +36,7 @@ describe('Evidence Block', () => { }); it('renders the title for the dowload link', () => { - expect(wrapper.findComponent(GlLink).text()).toBe(`v1.1-evidences-1.json`); + expect(wrapper.findComponent(GlLink).text()).toMatch(/v1\.1-evidences-[0-9]+\.json/); }); it('renders the correct hover text for the download', () => { @@ -44,7 +44,9 @@ describe('Evidence Block', () => { }); it('renders the correct file link for download', () => { - expect(wrapper.findComponent(GlLink).attributes().download).toBe(`v1.1-evidences-1.json`); + expect(wrapper.findComponent(GlLink).attributes().download).toMatch( + /v1\.1-evidences-[0-9]+\.json/, + ); }); describe('sha text', () => { diff --git a/spec/frontend/releases/util_spec.js b/spec/frontend/releases/util_spec.js index 055c8e8b39f..14cce8320e9 100644 --- a/spec/frontend/releases/util_spec.js +++ b/spec/frontend/releases/util_spec.js @@ -115,8 +115,18 @@ describe('releases/util.js', () => { author: { id: expect.any(String), }, + evidences: [ + { + id: expect.any(String), + filepath: expect.any(String), + }, + ], }, ], + paginationInfo: { + startCursor: expect.any(String), + endCursor: expect.any(String), + }, }); }); }); @@ -128,6 +138,12 @@ describe('releases/util.js', () => { author: { id: expect.any(String), }, + evidences: [ + { + id: expect.any(String), + filepath: expect.any(String), + }, + ], }, }); }); diff --git a/spec/models/diff_viewer/server_side_spec.rb b/spec/models/diff_viewer/server_side_spec.rb index 28660b0d4b9..db0814af422 100644 --- a/spec/models/diff_viewer/server_side_spec.rb +++ b/spec/models/diff_viewer/server_side_spec.rb @@ -17,10 +17,30 @@ RSpec.describe DiffViewer::ServerSide do subject { viewer_class.new(diff_file) } describe '#prepare!' do - it 'loads all diff file data' do - expect(Blob).to receive(:lazy).at_least(:twice) + before do + stub_feature_flags(disable_load_entire_blob_for_diff_viewer: feature_flag_enabled) + end + + context 'when the disable_load_entire_blob_for_diff_viewer flag is disabled' do + let(:feature_flag_enabled) { false } - subject.prepare! + it 'loads all diff file data' do + subject + expect(diff_file).to receive_message_chain(:old_blob, :load_all_data!) + expect(diff_file).to receive_message_chain(:new_blob, :load_all_data!) + subject.prepare! + end + end + + context 'when the disable_load_entire_blob_for_diff_viewer flag is enabled' do + let(:feature_flag_enabled) { true } + + it 'does not load file data' do + subject + expect(diff_file).not_to receive(:old_blob) + expect(diff_file).not_to receive(:new_blob) + subject.prepare! + end end end diff --git a/spec/support/database/prevent_cross_database_modification.rb b/spec/support/database/prevent_cross_database_modification.rb index c509aecf9b8..19fbf902d87 100644 --- a/spec/support/database/prevent_cross_database_modification.rb +++ b/spec/support/database/prevent_cross_database_modification.rb @@ -14,18 +14,18 @@ RSpec.configure do |config| # By default allow cross-modifications as we want to observe only transactions # within a specific block of execution which is defined be `before(:each)` and `after(:each)` config.before(:all) do - ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress = true + ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress_in_rspec = true end # Using before and after blocks because the around block causes problems with the let_it_be # record creations. It makes an extra savepoint which breaks the transaction count logic. config.before do |example_file| - ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress = + ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress_in_rspec = CROSS_DB_MODIFICATION_ALLOW_LIST.include?(example_file.file_path_rerun_argument) end # Reset after execution to preferred state config.after do |example_file| - ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress = true + ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress_in_rspec = true end end diff --git a/spec/tooling/danger/config_files_spec.rb b/spec/tooling/danger/config_files_spec.rb index 0e01908a1dd..88b327df63f 100644 --- a/spec/tooling/danger/config_files_spec.rb +++ b/spec/tooling/danger/config_files_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Tooling::Danger::ConfigFiles do let(:file_lines) do [ "---", - "name: about_your_company_registration_flow", + "name: about_some_new_flow", "introduced_by_url: #{url}", "rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/355909", "milestone: '14.10'" |