From cae8b56b33fec53afddc2aba8278d85c961b4f65 Mon Sep 17 00:00:00 2001 From: Bogdan Irimie Date: Mon, 27 Apr 2020 18:23:54 +0300 Subject: [PATCH] (FACT-2555) Add test for family. --- spec/framework/detector/os_detector_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/framework/detector/os_detector_spec.rb b/spec/framework/detector/os_detector_spec.rb index 8fd7453ef..5592c379f 100644 --- a/spec/framework/detector/os_detector_spec.rb +++ b/spec/framework/detector/os_detector_spec.rb @@ -161,6 +161,19 @@ it 'constructs hierarchy with linux' do expect(OsDetector.instance.hierarchy).to eq(['linux']) end + + context 'when family is known' do + before do + allow(Facter::Resolvers::OsRelease).to receive(:resolve).with(:id_like).and_return(:ubuntu) + allow(os_hierarchy).to receive(:construct_hierarchy).with(:ubuntu).and_return(%w[Linux Debian Ubuntu]) + Singleton.__init__(OsDetector) + OsDetector.instance + end + + it 'constructs hierarchy with linux' do + expect(OsDetector.instance.hierarchy).to eq(%w[Linux Debian Ubuntu]) + end + end end end end