diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-03 18:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-03 18:10:03 +0300 |
commit | f397d486bc77b286d42f83b89e0879428c05299d (patch) | |
tree | 8cabde42b9c8431ca8cdb5a21ae9f3102fe94f27 /spec | |
parent | 6b3944a90167998424f6f258dcffcd4ec740ef03 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/startup_css.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb | 12 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 16 | ||||
-rw-r--r-- | spec/serializers/ci/pipeline_entity_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/projects/update_pages_service_spec.rb | 23 | ||||
-rw-r--r-- | spec/support/shared_examples/features/packages_shared_examples.rb | 2 |
7 files changed, 53 insertions, 16 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index a697baa1512..902c75efcc7 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -634,7 +634,7 @@ RSpec.describe 'Admin updates settings' do it "change Pages Let's Encrypt settings" do visit preferences_admin_application_settings_path page.within('.as-pages') do - fill_in 'Email', with: 'my@test.example.com' + fill_in "Let's Encrypt email", with: 'my@test.example.com' check "I have read and agree to the Let's Encrypt Terms of Service" click_button 'Save changes' end diff --git a/spec/frontend/fixtures/startup_css.rb b/spec/frontend/fixtures/startup_css.rb index 53da7d7cb85..be2ead756cf 100644 --- a/spec/frontend/fixtures/startup_css.rb +++ b/spec/frontend/fixtures/startup_css.rb @@ -10,7 +10,6 @@ RSpec.describe 'Startup CSS fixtures', type: :controller do render_views before(:all) do - stub_feature_flags(sidebar_refactor: true) clean_frontend_fixtures('startup_css/') end @@ -31,17 +30,6 @@ RSpec.describe 'Startup CSS fixtures', type: :controller do expect(response).to be_successful end - it "startup_css/project-#{type}-legacy-sidebar.html" do - stub_feature_flags(sidebar_refactor: false) - - get :show, params: { - namespace_id: project.namespace.to_param, - id: project - } - - expect(response).to be_successful - end - it "startup_css/project-#{type}-signed-out.html" do sign_out(user) diff --git a/spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb b/spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb index 60792a6bf65..6494cdfe522 100644 --- a/spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb +++ b/spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb @@ -216,4 +216,16 @@ RSpec.describe Gitlab::MarkdownCache::ActiveRecord::Extension do end end end + + context 'when persisted cache is newer than current version' do + before do + thing.update_column(:cached_markdown_version, thing.cached_markdown_version + 1) + end + + it 'does not save the generated HTML' do + expect(thing).not_to receive(:update_columns) + + thing.refresh_markdown_cache! + end + end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0aad1257eea..f16277c3ff6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -4039,6 +4039,14 @@ RSpec.describe User do ] end end + + context 'when the user is not saved' do + let(:user) { build(:user) } + + it 'returns empty when there are no groups or ancestor groups for the user' do + is_expected.to eq([]) + end + end end describe '#refresh_authorized_projects', :clean_gitlab_redis_shared_state do @@ -4300,6 +4308,14 @@ RSpec.describe User do expect(user.two_factor_grace_period).to be 48 end end + + context 'when the user is not saved' do + let(:user) { build(:user) } + + it 'does not raise an ActiveRecord::StatementInvalid statement exception' do + expect { user.update_two_factor_requirement }.not_to raise_error + end + end end describe '#source_groups_of_two_factor_authentication_requirement' do diff --git a/spec/serializers/ci/pipeline_entity_spec.rb b/spec/serializers/ci/pipeline_entity_spec.rb index 054406e4e65..f79bbd91a0a 100644 --- a/spec/serializers/ci/pipeline_entity_spec.rb +++ b/spec/serializers/ci/pipeline_entity_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Ci::PipelineEntity do let(:pipeline) { create(:ci_empty_pipeline) } it 'contains required fields' do - expect(subject).to include :id, :user, :path, :coverage, :source + expect(subject).to include :id, :iid, :user, :path, :coverage, :source expect(subject).to include :ref, :commit expect(subject).to include :updated_at, :created_at end diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index 5898504b463..fd858fa9550 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -158,6 +158,21 @@ RSpec.describe Projects::UpdatePagesService do expect(execute).not_to eq(:success) end + it 'limits pages file count' do + create(:plan_limits, :default_plan, pages_file_entries: 2) + + expect(execute).not_to eq(:success) + + expect(GenericCommitStatus.last.description).to eq("pages site contains 3 file entries, while limit is set to 2") + end + + it 'does not limit pages file count if feature is disabled' do + stub_feature_flags(pages_limit_entries_count: false) + create(:plan_limits, :default_plan, pages_file_entries: 2) + + expect(execute).to eq(:success) + end + it 'removes pages after destroy' do expect(PagesWorker).to receive(:perform_in) expect(project.pages_deployed?).to be_falsey @@ -339,9 +354,15 @@ RSpec.describe Projects::UpdatePagesService do create(:ci_job_artifact, :archive, file: file, job: build) create(:ci_job_artifact, :metadata, file: metafile, job: build) - allow(build).to receive(:artifacts_metadata_entry) + allow(build).to receive(:artifacts_metadata_entry).with('public/', recursive: true) .and_return(metadata) allow(metadata).to receive(:total_size).and_return(100) + + # to pass entries count check + root_metadata = double('root metadata') + allow(build).to receive(:artifacts_metadata_entry).with('', recursive: true) + .and_return(root_metadata) + allow(root_metadata).to receive_message_chain(:entries, :count).and_return(10) end it 'raises an error' do diff --git a/spec/support/shared_examples/features/packages_shared_examples.rb b/spec/support/shared_examples/features/packages_shared_examples.rb index 9e88db2e1c0..361e9590999 100644 --- a/spec/support/shared_examples/features/packages_shared_examples.rb +++ b/spec/support/shared_examples/features/packages_shared_examples.rb @@ -100,7 +100,7 @@ def click_sort_option(option, ascending) # Reset the sort direction click_button 'Sort direction' if page.has_selector?('svg[aria-label="Sorting Direction: Ascending"]', wait: 0) - find('button.dropdown-menu-toggle').click + find('button.gl-dropdown-toggle').click page.within('.dropdown-menu') do click_button option |