Commit f1a210d0 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'rubocop-performance-openstruct-application_settings_helper-325744' into 'master'

Fix the offences introduced by Performance/OpenStruct

See merge request gitlab-org/gitlab!70902
parents ce45fe71 eebf72d8
...@@ -11,7 +11,6 @@ Style/OpenStructUse: ...@@ -11,7 +11,6 @@ Style/OpenStructUse:
- lib/gitlab/git/diff_collection.rb - lib/gitlab/git/diff_collection.rb
- lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb - lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
- lib/gitlab/testing/request_inspector_middleware.rb - lib/gitlab/testing/request_inspector_middleware.rb
- lib/mattermost/session.rb
- spec/factories/go_module_versions.rb - spec/factories/go_module_versions.rb
- spec/factories/wiki_pages.rb - spec/factories/wiki_pages.rb
- spec/graphql/mutations/branches/create_spec.rb - spec/graphql/mutations/branches/create_spec.rb
......
...@@ -27,6 +27,11 @@ module Mattermost ...@@ -27,6 +27,11 @@ module Mattermost
LEASE_TIMEOUT = 60 LEASE_TIMEOUT = 60
Request = Struct.new(:parameters, keyword_init: true) do
def method_missing(method_name, *args, &block)
end
end
attr_accessor :current_resource_owner, :token, :base_uri attr_accessor :current_resource_owner, :token, :base_uri
def initialize(current_user) def initialize(current_user)
...@@ -64,7 +69,7 @@ module Mattermost ...@@ -64,7 +69,7 @@ module Mattermost
end end
def request def request
@request ||= OpenStruct.new(parameters: params) @request ||= Request.new(parameters: params)
end end
def params def params
......
...@@ -35,6 +35,12 @@ RSpec.describe Mattermost::Session, type: :request do ...@@ -35,6 +35,12 @@ RSpec.describe Mattermost::Session, type: :request do
it 'makes a request to the oauth uri' do it 'makes a request to the oauth uri' do
expect { subject.with_session }.to raise_error(::Mattermost::NoSessionError) expect { subject.with_session }.to raise_error(::Mattermost::NoSessionError)
end end
it 'returns nill on calling a non exisitng method on request' do
return_value = subject.request.method_missing("non_existing_method", "something") do
end
expect(return_value).to be(nil)
end
end end
context 'with oauth_uri' do context 'with oauth_uri' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment