X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Ffacter%2Futil%2Ffact_rabbitmq_version_spec.rb;fp=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Ffacter%2Futil%2Ffact_rabbitmq_version_spec.rb;h=65edd33613ff00816546fdc1898ca64e148dccbc;hb=94a8783f522bbf2996cb8a59b977dea583e8b0c7;hp=0000000000000000000000000000000000000000;hpb=e107504bce7d9b21cc301124fc7c39fdb0762374;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_version_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_version_spec.rb new file mode 100644 index 000000000..65edd3361 --- /dev/null +++ b/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_version_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +RSpec.configure do |config| + config.mock_with :rspec +end + +describe Facter::Util::Fact do + before do + Facter.clear + end + + describe 'rabbitmq_version' do + context 'with value' do + before do + allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { true } + allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqadmin --version 2>&1') { 'rabbitmqadmin 3.6.0' } + end + it do + expect(Facter.fact(:rabbitmq_version).value).to eq('3.6.0') + end + end + context 'rabbitmqadmin is not in path' do + before do + allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { false } + end + it do + expect(Facter.fact(:rabbitmq_version).value).to be_nil + end + end + end +end