diff options
Diffstat (limited to 'spec/support/shared_examples/metrics_instrumentation_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/metrics_instrumentation_shared_examples.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/support/shared_examples/metrics_instrumentation_shared_examples.rb b/spec/support/shared_examples/metrics_instrumentation_shared_examples.rb index 5c2f66e08db..4249b90bf66 100644 --- a/spec/support/shared_examples/metrics_instrumentation_shared_examples.rb +++ b/spec/support/shared_examples/metrics_instrumentation_shared_examples.rb @@ -31,11 +31,13 @@ RSpec.shared_examples 'a correct instrumented metric query' do |params| end before do - allow(metric.send(:relation).connection).to receive(:transaction_open?).and_return(false) + if metric.respond_to?(:relation, true) && metric.send(:relation).respond_to?(:connection) + allow(metric.send(:relation).connection).to receive(:transaction_open?).and_return(false) + end end it 'has correct generate query' do - expect(metric.to_sql).to eq(expected_query) + expect(metric.instrumentation).to eq(expected_query) end end |