From 409f8ef4e33ab34edbd9b1dca2d2ce1a6419c739 Mon Sep 17 00:00:00 2001 From: Prachetas Prabhu Date: Wed, 4 Mar 2015 23:55:30 +0000 Subject: [PATCH] Adds rspec tests for nginx_cfg_prepend --- spec/classes/config_spec.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index ba50afa..e1108ea 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -164,6 +164,35 @@ describe 'nginx::config' do ' test1 test value 2;', ], }, + { + :title => 'should contain ordered appended directives from hash', + :attr => 'nginx_cfg_prepend', + :value => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'allow' => 'test value 3' }, + :match => [ + 'allow test value 3;', + 'test1 test value 1;', + 'test2 test value 2;', + ], + }, + { + :title => 'should contain duplicate appended directives from list of hashes', + :attr => 'nginx_cfg_prepend', + :value => [[ 'allow', 'test value 1'], ['allow', 'test value 2' ]], + :match => [ + 'allow test value 1;', + 'allow test value 2;', + ], + }, + { + :title => 'should contain duplicate appended directives from array values', + :attr => 'nginx_cfg_prepend', + :value => { 'test1' => ['test value 1', 'test value 2', 'test value 3'] }, + :match => [ + 'test1 test value 1;', + 'test1 test value 2;', + 'test1 test value 3;', + ], + }, { :title => 'should set pid', :attr => 'pid',