diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-05-16 13:53:54 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-05-16 13:53:54 +0300 |
commit | 33af33d7cbf947055a2a40dc2dddf74dfb13079c (patch) | |
tree | 2addb0fa11738df14a91afe26160fd7f229c2ca4 /spec | |
parent | 75f94fc39bedbc635bd4bc52cdf145d1e81752dd (diff) |
Fix GPM content types for Doorkeeper
Certain controllers (e.g. Doorkeeper::TokensController) don't expose the
method "request_format". This commit changes
Gitlab::Metrics::WebTransaction so we don't rely on this method, instead
using the underlying code this method uses.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/46412
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/metrics/web_transaction_spec.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/lib/gitlab/metrics/web_transaction_spec.rb b/spec/lib/gitlab/metrics/web_transaction_spec.rb index c07b33a039a..6eb0600f49e 100644 --- a/spec/lib/gitlab/metrics/web_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/web_transaction_spec.rb @@ -180,11 +180,11 @@ describe Gitlab::Metrics::WebTransaction do end context 'when request goes to ActionController' do - let(:request_format) { :html } + let(:request) { double(:request, format: double(:format, ref: :html)) } before do klass = double(:klass, name: 'TestController') - controller = double(:controller, class: klass, action_name: 'show', request_format: request_format) + controller = double(:controller, class: klass, action_name: 'show', request: request) env['action_controller.instance'] = controller end @@ -195,7 +195,7 @@ describe Gitlab::Metrics::WebTransaction do end context 'when the response content type is not :html' do - let(:request_format) { :json } + let(:request) { double(:request, format: double(:format, ref: :json)) } it 'appends the mime type to the transaction action' do expect(transaction.labels).to eq({ controller: 'TestController', action: 'show.json' }) |