diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-24 15:12:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-24 15:12:07 +0300 |
commit | 263baf70a1f64bb773bfb57d74516a008c2bc7e4 (patch) | |
tree | 3fd07a2e7bccc2f6d19a1423c322240bd9808234 /spec/lib | |
parent | 0086677f7cad8c0d7e73d8584ce317f1fce5534e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/api/helpers/caching_spec.rb | 9 | ||||
-rw-r--r-- | spec/lib/gitlab/audit/auditor_spec.rb | 9 | ||||
-rw-r--r-- | spec/lib/gitlab/cache/helpers_spec.rb | 9 |
3 files changed, 18 insertions, 9 deletions
diff --git a/spec/lib/api/helpers/caching_spec.rb b/spec/lib/api/helpers/caching_spec.rb index 38b7b386d5c..828af7b5f91 100644 --- a/spec/lib/api/helpers/caching_spec.rb +++ b/spec/lib/api/helpers/caching_spec.rb @@ -33,10 +33,7 @@ RSpec.describe API::Helpers::Caching, :use_clean_rails_redis_caching do end describe "#present_cached" do - subject do - instance.present_cached(presentable, **kwargs) - end - + let(:method) { :present_cached } let(:kwargs) do { with: presenter, @@ -44,6 +41,10 @@ RSpec.describe API::Helpers::Caching, :use_clean_rails_redis_caching do } end + subject do + instance.public_send(method, presentable, **kwargs) + end + context 'single object' do let_it_be(:presentable) { create(:todo, project: project) } diff --git a/spec/lib/gitlab/audit/auditor_spec.rb b/spec/lib/gitlab/audit/auditor_spec.rb index fc5917ca583..f743515e616 100644 --- a/spec/lib/gitlab/audit/auditor_spec.rb +++ b/spec/lib/gitlab/audit/auditor_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Gitlab::Audit::Auditor do let(:name) { 'audit_operation' } - let(:author) { create(:user) } + let(:author) { create(:user, :with_sign_ins) } let(:group) { create(:group) } let(:provider) { 'standard' } let(:context) do @@ -37,6 +37,13 @@ RSpec.describe Gitlab::Audit::Auditor do ).and_call_original audit! + + authentication_event = AuthenticationEvent.last + + expect(authentication_event.user).to eq(author) + expect(authentication_event.user_name).to eq(author.name) + expect(authentication_event.ip_address).to eq(author.current_sign_in_ip) + expect(authentication_event.provider).to eq(provider) end it 'logs audit events to database', :aggregate_failures do diff --git a/spec/lib/gitlab/cache/helpers_spec.rb b/spec/lib/gitlab/cache/helpers_spec.rb index 08e0d7729bd..39d37e979b4 100644 --- a/spec/lib/gitlab/cache/helpers_spec.rb +++ b/spec/lib/gitlab/cache/helpers_spec.rb @@ -18,10 +18,7 @@ RSpec.describe Gitlab::Cache::Helpers, :use_clean_rails_redis_caching do end describe "#render_cached" do - subject do - instance.render_cached(presentable, **kwargs) - end - + let(:method) { :render_cached } let(:kwargs) do { with: presenter, @@ -29,6 +26,10 @@ RSpec.describe Gitlab::Cache::Helpers, :use_clean_rails_redis_caching do } end + subject do + instance.public_send(method, presentable, **kwargs) + end + context 'single object' do let_it_be(:presentable) { create(:merge_request, source_project: project, source_branch: 'wip') } |