diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/initializers/sawyer_patch_spec.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/initializers/sawyer_patch_spec.rb')
-rw-r--r-- | spec/initializers/sawyer_patch_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/initializers/sawyer_patch_spec.rb b/spec/initializers/sawyer_patch_spec.rb index dc922654d7d..b3c10e63460 100644 --- a/spec/initializers/sawyer_patch_spec.rb +++ b/spec/initializers/sawyer_patch_spec.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'fast_spec_helper' +require 'spec_helper' require 'sawyer' require_relative '../../config/initializers/sawyer_patch' @@ -64,6 +64,28 @@ RSpec.describe 'sawyer_patch' do expect(sawyer_resource.count_total).to eq(1) expect(sawyer_resource.count_total?).to eq(true) expect(sawyer_resource.count_total + 1).to eq(2) + sawyer_resource.count_total = 3 + expect(sawyer_resource.count_total).to eq(3) expect(sawyer_resource.user.name).to eq('User name') end + + it 'logs when a sawyer resource dynamic method is called' do + sawyer_resource = Sawyer::Resource.new( + Sawyer::Agent.new(''), + { + count_total: 1, + user: { name: 'User name' } + } + ) + expected_attributes = [] + allow(Gitlab::Import::Logger).to receive(:warn) do |params| + expected_attributes.push(params[:attribute]) + end + + sawyer_resource.count_total + sawyer_resource.user + sawyer_resource.user.name + + expect(expected_attributes).to match_array(%i[count_total user user name]) + end end |