File: mongodb_password_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 (27 lines) | stat: -rw-r--r-- 838 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
require 'spec_helper'

describe 'the mongodb_password function' do
  before :all do
    Puppet::Parser::Functions.autoloader.loadall
  end

  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  it 'should exist' do
    Puppet::Parser::Functions.function('mongodb_password').should == 'function_mongodb_password'
  end

  it 'should raise a ParseError if there no arguments' do
    lambda { scope.function_mongodb_password([]) }.should( raise_error(Puppet::ParseError))
  end

  it 'should raise a ParseError if there is more than 2 arguments' do
    lambda { scope.function_mongodb_password(%w(foo bar baz)) }.should( raise_error(Puppet::ParseError))
  end

  it 'should convert password into a hash' do
    result = scope.function_mongodb_password(%w(user pass))
    result.should(eq('e0c4a7b97d4db31f5014e9694e567d6b'))
  end

end