summaryrefslogtreecommitdiff
path: root/spec/initializers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-01-23 14:41:32 +0000
committerSean McGivern <sean@gitlab.com>2017-01-24 14:42:57 +0000
commita96765e6274b9b6886ee6172d25d47a9d36f18c6 (patch)
tree9b78fa6d16da7b4be5de2f4324cdcb4ee63a1ea6 /spec/initializers
parent65bf7e0d92856d90215ca908751e676393c10618 (diff)
downloadgitlab-ce-a96765e6274b9b6886ee6172d25d47a9d36f18c6.tar.gz
Add metric initializer specadd-metrics-initializer-spec
An empty file in one of the instrumented directories will cause the app to fail to start when metrics are enabled. Metrics aren't enabled by default in development or test. We could handle the empty file case explicitly, but a file could still not define the constant it is expected to, so instead run the initializer manually in a spec and check that it succeeds.
Diffstat (limited to 'spec/initializers')
-rw-r--r--spec/initializers/metrics_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/initializers/metrics_spec.rb b/spec/initializers/metrics_spec.rb
new file mode 100644
index 00000000000..bb595162370
--- /dev/null
+++ b/spec/initializers/metrics_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+require_relative '../../config/initializers/metrics'
+
+describe 'instrument_classes', lib: true do
+ let(:config) { double(:config) }
+
+ before do
+ allow(config).to receive(:instrument_method)
+ allow(config).to receive(:instrument_methods)
+ allow(config).to receive(:instrument_instance_methods)
+ end
+
+ it 'can autoload and instrument all files' do
+ expect { instrument_classes(config) }.not_to raise_error
+ end
+end