diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-12-10 15:38:45 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-12-17 19:25:48 +0300 |
commit | b66a16c8384b64eabeb04f3f32017581e4711eb8 (patch) | |
tree | 4423e0a84adb85a51ab7827f470e93cbb2f45f26 /spec/lib/gitlab/metrics/instrumentation_spec.rb | |
parent | 60a6a240ea21cbfa564b9373b1c3bb57316aae46 (diff) |
Use string evaluation for method instrumentation
This is faster than using define_method since we don't have to keep
block bindings around.
Diffstat (limited to 'spec/lib/gitlab/metrics/instrumentation_spec.rb')
-rw-r--r-- | spec/lib/gitlab/metrics/instrumentation_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/lib/gitlab/metrics/instrumentation_spec.rb b/spec/lib/gitlab/metrics/instrumentation_spec.rb index eb31c9e52cd..3e7e9869e30 100644 --- a/spec/lib/gitlab/metrics/instrumentation_spec.rb +++ b/spec/lib/gitlab/metrics/instrumentation_spec.rb @@ -11,6 +11,8 @@ describe Gitlab::Metrics::Instrumentation do text end end + + allow(@dummy).to receive(:name).and_return('Dummy') end describe '.instrument_method' do @@ -31,7 +33,7 @@ describe Gitlab::Metrics::Instrumentation do it 'fires an ActiveSupport notification upon calling the method' do expect(ActiveSupport::Notifications).to receive(:instrument). - with('class_method.method_call', module: @dummy, name: :foo) + with('class_method.method_call', module: 'Dummy', name: :foo) @dummy.foo end @@ -69,7 +71,7 @@ describe Gitlab::Metrics::Instrumentation do it 'fires an ActiveSupport notification upon calling the method' do expect(ActiveSupport::Notifications).to receive(:instrument). - with('instance_method.method_call', module: @dummy, name: :bar) + with('instance_method.method_call', module: 'Dummy', name: :bar) @dummy.new.bar end |