summaryrefslogtreecommitdiff
path: root/spec/defines/openvpn_option_spec.rb
diff options
context:
space:
mode:
authorRaffael Schmid <raffael@yux.ch>2012-12-29 20:01:04 -0800
committerRaffael Schmid <raffael@yux.ch>2012-12-29 20:01:04 -0800
commitbd1b80388b0ae2fb7c4ef6ae9166809c98aa5ae9 (patch)
tree8a6d340e06f35cd002374a3627cbc015666b9f95 /spec/defines/openvpn_option_spec.rb
parent1052248662a3e2f54d21bfd529060e6ffb3594ac (diff)
parentabdf54d7d55da5a6116caf8f283faa115ec7e49c (diff)
Merge pull request #5 from jlambert121/rspec_tests
added rspec tests, minor cleanup
Diffstat (limited to 'spec/defines/openvpn_option_spec.rb')
-rw-r--r--spec/defines/openvpn_option_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/defines/openvpn_option_spec.rb b/spec/defines/openvpn_option_spec.rb
new file mode 100644
index 0000000..a2d1661
--- /dev/null
+++ b/spec/defines/openvpn_option_spec.rb
@@ -0,0 +1,42 @@
+require 'spec_helper'
+
+describe 'openvpn::option', :type => :define do
+
+ let(:title) { 'test_param' }
+
+ context "when key => 'test_key', server => 'test_server'" do
+ let(:params) { { 'key' => 'test_key', 'server' => 'test_server' } }
+
+ it { should contain_concat__fragment('openvpn.test_server..test_param').with(
+ 'target' => '/etc/openvpn/test_server.conf',
+ 'content' => "test_key\n"
+ ) }
+ end
+
+ context "when key => 'test_key', value => 'test_value', server => 'test_server'" do
+ let(:params) { { 'key' => 'test_key', 'value' => 'test_value', 'server' => 'test_server' } }
+
+ it { should contain_concat__fragment('openvpn.test_server..test_param').with(
+ 'target' => '/etc/openvpn/test_server.conf',
+ 'content' => "test_key test_value\n"
+ ) }
+ end
+
+ context "when key => 'test_key', server => 'test_server', client => 'test_client'" do
+ let(:params) { { 'key' => 'test_key', 'server' => 'test_server', 'client' => 'test_client' } }
+
+ it { should contain_concat__fragment('openvpn.test_server.test_client.test_param').with(
+ 'target' => '/etc/openvpn/test_server/download-configs/test_client/test_client.conf',
+ 'content' => "test_key\n"
+ ) }
+ end
+
+ context "when key => 'test_key', server => 'test_server', client => 'test_client', csc => true" do
+ let(:params) { { 'key' => 'test_key', 'server' => 'test_server', 'client' => 'test_client', 'csc' => 'true' } }
+
+ it { should contain_concat__fragment('openvpn.test_server.test_client.test_param').with(
+ 'target' => '/etc/openvpn/test_server/client-configs/test_client',
+ 'content' => "test_key\n"
+ ) }
+ end
+end