Use Rails.root for CommonMetricsImporter
This commit is contained in:
parent
b9ea4e35ac
commit
fe8b842a75
2 changed files with 12 additions and 2 deletions
|
@ -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
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue