summaryrefslogtreecommitdiff
path: root/spec/defines/listen_spec.rb
diff options
context:
space:
mode:
authorHunter Haugen <h.haugen@gmail.com>2012-10-12 11:49:39 -0700
committerHunter Haugen <h.haugen@gmail.com>2012-10-12 11:49:39 -0700
commit5d92b84d02befd48e1392bdd9ee21c7cb5a0b321 (patch)
tree1318b8a2daf4ab737d4e01b85328315a2df926ac /spec/defines/listen_spec.rb
parentf96656440027fbfc73bccf1911c817d7e4392713 (diff)
parent3ab65f56a61cfedbe75a3b41143f0d44fbad0a93 (diff)
Merge pull request #13 from hunner/rename_everything
Rename everything! Reviewed by: Cody
Diffstat (limited to 'spec/defines/listen_spec.rb')
-rw-r--r--spec/defines/listen_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/defines/listen_spec.rb b/spec/defines/listen_spec.rb
new file mode 100644
index 0000000..c4539b8
--- /dev/null
+++ b/spec/defines/listen_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe 'haproxy::listen' do
+ let(:title) { 'tyler' }
+ let(:facts) {{ :ipaddress => '1.1.1.1' }}
+ context "when only one port is provided" do
+ let(:params) do
+ { :name => 'croy',
+ :ports => '18140'
+ }
+ end
+
+ it { should contain_concat__fragment('croy_listen_block').with(
+ 'order' => '20',
+ 'target' => '/etc/haproxy/haproxy.cfg',
+ 'content' => "\nlisten croy 1.1.1.1:18140\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
+ ) }
+ end
+ context "when an array of ports is provided" do
+ let(:params) do
+ { :name => 'apache',
+ :ipaddress => '23.23.23.23',
+ :ports => [
+ '80',
+ '443',
+ ]
+ }
+ end
+
+ it { should contain_concat__fragment('apache_listen_block').with(
+ 'order' => '20',
+ 'target' => '/etc/haproxy/haproxy.cfg',
+ 'content' => "\nlisten apache 23.23.23.23:80,23.23.23.23:443\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
+ ) }
+ end
+end