Commit e6f548fc authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-fix-profiler-ruby-5.1' into 'master'

Fix Profiler to work with Rails 5.1

Closes #61051

See merge request gitlab-org/gitlab-ce!27774
parents 4047e5b8 266ba11e
...@@ -73,7 +73,7 @@ module Gitlab ...@@ -73,7 +73,7 @@ module Gitlab
result = with_custom_logger(logger) do result = with_custom_logger(logger) do
with_user(user) do with_user(user) do
RubyProf.profile { app.public_send(verb, url, post_data, headers) } # rubocop:disable GitlabSecurity/PublicSend RubyProf.profile { app.public_send(verb, url, params: post_data, headers: headers) } # rubocop:disable GitlabSecurity/PublicSend
end end
end end
......
...@@ -27,13 +27,13 @@ describe Gitlab::Profiler do ...@@ -27,13 +27,13 @@ describe Gitlab::Profiler do
it 'sends a POST request when data is passed' do it 'sends a POST request when data is passed' do
post_data = '{"a":1}' post_data = '{"a":1}'
expect(app).to receive(:post).with(anything, post_data, anything) expect(app).to receive(:post).with(anything, params: post_data, headers: anything)
described_class.profile('/', post_data: post_data) described_class.profile('/', post_data: post_data)
end end
it 'uses the private_token for auth if given' do it 'uses the private_token for auth if given' do
expect(app).to receive(:get).with('/', nil, 'Private-Token' => private_token) expect(app).to receive(:get).with('/', params: nil, headers: { 'Private-Token' => private_token })
expect(app).to receive(:get).with('/api/v4/users') expect(app).to receive(:get).with('/api/v4/users')
described_class.profile('/', private_token: private_token) described_class.profile('/', private_token: private_token)
...@@ -51,7 +51,7 @@ describe Gitlab::Profiler do ...@@ -51,7 +51,7 @@ describe Gitlab::Profiler do
user = double(:user) user = double(:user)
expect(described_class).to receive(:with_user).with(nil).and_call_original expect(described_class).to receive(:with_user).with(nil).and_call_original
expect(app).to receive(:get).with('/', nil, 'Private-Token' => private_token) expect(app).to receive(:get).with('/', params: nil, headers: { 'Private-Token' => private_token })
expect(app).to receive(:get).with('/api/v4/users') expect(app).to receive(:get).with('/api/v4/users')
described_class.profile('/', user: user, private_token: private_token) described_class.profile('/', user: user, private_token: private_token)
......
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