diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/initializers | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/initializers')
-rw-r--r-- | spec/initializers/100_patch_omniauth_saml_spec.rb | 5 | ||||
-rw-r--r-- | spec/initializers/attr_encrypted_no_db_connection_spec.rb | 20 | ||||
-rw-r--r-- | spec/initializers/global_id_spec.rb | 4 | ||||
-rw-r--r-- | spec/initializers/lograge_spec.rb | 2 | ||||
-rw-r--r-- | spec/initializers/mailer_retries_spec.rb | 18 |
5 files changed, 23 insertions, 26 deletions
diff --git a/spec/initializers/100_patch_omniauth_saml_spec.rb b/spec/initializers/100_patch_omniauth_saml_spec.rb index 3496eb4d680..de556cfa1e5 100644 --- a/spec/initializers/100_patch_omniauth_saml_spec.rb +++ b/spec/initializers/100_patch_omniauth_saml_spec.rb @@ -7,10 +7,11 @@ RSpec.describe 'OmniAuth::Strategies::SAML', type: :strategy do let(:strategy) { [OmniAuth::Strategies::SAML, { idp_sso_target_url: idp_sso_target_url }] } describe 'POST /users/auth/saml' do - it 'redirects to the provider login page' do + it 'redirects to the provider login page', :aggregate_failures do post '/users/auth/saml' - expect(last_response).to redirect_to(/\A#{Regexp.quote(idp_sso_target_url)}/) + expect(last_response.status).to eq(302) + expect(last_response.location).to match(/\A#{Regexp.quote(idp_sso_target_url)}/) end it 'stores request ID during request phase' do diff --git a/spec/initializers/attr_encrypted_no_db_connection_spec.rb b/spec/initializers/attr_encrypted_no_db_connection_spec.rb index ad3d14ed7d4..34d9e182370 100644 --- a/spec/initializers/attr_encrypted_no_db_connection_spec.rb +++ b/spec/initializers/attr_encrypted_no_db_connection_spec.rb @@ -4,18 +4,20 @@ require 'spec_helper' RSpec.describe 'GitLab monkey-patches to AttrEncrypted' do describe '#attribute_instance_methods_as_symbols_available?' do - it 'returns false' do - expect(ActiveRecord::Base.__send__(:attribute_instance_methods_as_symbols_available?)).to be_falsy - end - - it 'does not define virtual attributes' do - klass = Class.new(ActiveRecord::Base) do + let(:klass) do + Class.new(ActiveRecord::Base) do # We need some sort of table to work on self.table_name = 'projects' attr_encrypted :foo end + end + + it 'returns false' do + expect(ActiveRecord::Base.__send__(:attribute_instance_methods_as_symbols_available?)).to be_falsy + end + it 'does not define virtual attributes' do instance = klass.new aggregate_failures do @@ -28,5 +30,11 @@ RSpec.describe 'GitLab monkey-patches to AttrEncrypted' do end end end + + it 'calls attr_changed? method with kwargs' do + obj = klass.new + + expect(obj.foo_changed?).to eq(false) + end end end diff --git a/spec/initializers/global_id_spec.rb b/spec/initializers/global_id_spec.rb index 63bfa32d74f..4deb1833999 100644 --- a/spec/initializers/global_id_spec.rb +++ b/spec/initializers/global_id_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'global_id' do - it 'prepends `Gitlab::Patch::GlobalID`' do - expect(GlobalID.ancestors).to include(Gitlab::Patch::GlobalID) + it 'prepends `Gitlab::Patch::GlobalId`' do + expect(GlobalID.ancestors).to include(Gitlab::Patch::GlobalId) end it 'patches GlobalID to find aliased models when a deprecation exists' do diff --git a/spec/initializers/lograge_spec.rb b/spec/initializers/lograge_spec.rb index 651b0c8a9b8..a1fd9be299b 100644 --- a/spec/initializers/lograge_spec.rb +++ b/spec/initializers/lograge_spec.rb @@ -200,6 +200,8 @@ RSpec.describe 'lograge', type: :request do %w[ db_primary_wal_count db_replica_wal_count + db_primary_wal_cached_count + db_replica_wal_cached_count db_replica_count db_replica_cached_count db_primary_count diff --git a/spec/initializers/mailer_retries_spec.rb b/spec/initializers/mailer_retries_spec.rb index c1e56784ad9..a220188cc29 100644 --- a/spec/initializers/mailer_retries_spec.rb +++ b/spec/initializers/mailer_retries_spec.rb @@ -2,22 +2,8 @@ require 'spec_helper' -RSpec.describe 'Mailer retries' do - # We need to ensure that this runs through Sidekiq to take - # advantage of the middleware. There is a Rails bug that means we - # have to do some extra steps to make this happen: - # https://github.com/rails/rails/issues/37270#issuecomment-553927324 - around do |example| - descendants = ActiveJob::Base.descendants + [ActiveJob::Base] - descendants.each(&:disable_test_adapter) - ActiveJob::Base.queue_adapter = :sidekiq - - example.run - - descendants.each { |a| a.queue_adapter = :test } - end - - it 'sets retries for mailers to 3', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/332645' do +RSpec.describe 'Mailer retries', :sidekiq_mailers do + it 'sets retries for mailers to 3' do DeviseMailer.user_admin_approval(create(:user)).deliver_later expect(Sidekiq::Queues['mailers'].first).to include('retry' => 3) |