From 9002d86437255d9bc53dd965977912449bbdbe04 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Thu, 23 Jun 2016 23:07:48 -0400 Subject: [PATCH] add test for #813 --- spec/unit/nginx_version_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/unit/nginx_version_spec.rb b/spec/unit/nginx_version_spec.rb index 7ae5af4..0e2e288 100644 --- a/spec/unit/nginx_version_spec.rb +++ b/spec/unit/nginx_version_spec.rb @@ -6,7 +6,7 @@ describe Facter::Util::Fact do } describe "nginx_version" do - context 'with value' do + context 'with current version output format' do before :each do Facter::Util::Resolution.stubs(:which).with('nginx').returns(true) Facter::Util::Resolution.stubs(:exec).with('nginx -v 2>&1').returns('nginx version: nginx/1.8.1') @@ -15,5 +15,14 @@ describe Facter::Util::Fact do expect(Facter.fact(:nginx_version).value).to eq('1.8.1') } end + context 'with old version output format' do + before :each do + Facter::Util::Resolution.stubs(:which).with('nginx').returns(true) + Facter::Util::Resolution.stubs(:exec).with('nginx -v 2>&1').returns('nginx: nginx version: nginx/0.7.0') + end + it { + expect(Facter.fact(:nginx_version).value).to eq('0.7.0') + } + end end end