Commit fe8b842a authored by Kamil Trzciński's avatar Kamil Trzciński

Use Rails.root for CommonMetricsImporter

parent b9ea4e35
...@@ -35,8 +35,8 @@ module Importers ...@@ -35,8 +35,8 @@ module Importers
attr_reader :content attr_reader :content
def initialize(file = 'config/prometheus/common_metrics.yml') def initialize(filename = 'common_metrics.yml')
@content = YAML.load_file(file) @content = YAML.load_file(Rails.root.join('config', 'prometheus', filename))
end end
def execute def execute
......
...@@ -47,6 +47,16 @@ describe Importers::CommonMetricsImporter do ...@@ -47,6 +47,16 @@ describe Importers::CommonMetricsImporter do
end end
end end
context "does import common_metrics.yml" do
it "when executed from outside of the Rails.root" do
Dir.chdir(Dir.tmpdir) do
expect { subject.execute }.not_to raise_error
end
expect(PrometheusMetric.common).not_to be_empty
end
end
context 'does import properly all fields' do context 'does import properly all fields' do
let(:query_identifier) { 'response-metric' } let(:query_identifier) { 'response-metric' }
let(:group) do let(:group) do
......
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