File: db_spec.rb

package info (click to toggle)
puppet-module-puppetlabs-mongodb 0.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 304 kB
  • sloc: ruby: 982; sh: 10; makefile: 4
file content (43 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (3)
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
43
require 'spec_helper'

describe 'mongodb::db', :type => :define do
  let(:title) { 'testdb' }

  let(:params) {
    { 'user'     => 'testuser',
      'password' => 'testpass',
    }
  }

  it 'should contain mongodb_database with mongodb::server requirement' do
    should contain_mongodb_database('testdb')\
      .with_require('Class[Mongodb::Server]')
  end

  it 'should contain mongodb_user with mongodb_database requirement' do
    should contain_mongodb_user('testuser')\
      .with_require('Mongodb_database[testdb]')
  end

  it 'should contain mongodb_user with proper database name' do
    should contain_mongodb_user('testuser')\
      .with_database('testdb')
  end

  it 'should contain mongodb_user with proper roles' do
    params.merge!({'roles' => ['testrole1', 'testrole2']})
    should contain_mongodb_user('testuser')\
      .with_roles(["testrole1", "testrole2"])
  end

  it 'should prefer password_hash instead of password' do
    params.merge!({'password_hash' => 'securehash'})
    should contain_mongodb_user('testuser')\
      .with_password_hash('securehash')
  end

  it 'should contain mongodb_database with proper tries param' do
    params.merge!({'tries' => 5})
    should contain_mongodb_database('testdb').with_tries(5)
  end
end