summaryrefslogtreecommitdiff
path: root/spec/defines/openvpn_option_spec.rb
blob: a2d1661dcb5d0ba133b9c5063840ea2cbf4154f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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