File: is_service_default_spec.rb

package info (click to toggle)
puppet-module-openstacklib 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 968 kB
  • sloc: ruby: 4,500; python: 38; sh: 22; makefile: 10
file content (40 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (5)
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
require 'spec_helper'

describe 'is_service_default' do

  it 'refuses without at least one argument' do
    is_expected.to run.with_params().\
      and_raise_error(Puppet::ParseError, /Wrong number of arguments/)
  end

  it 'refuses too many arguments' do
    is_expected.to run.with_params('foo', 'bar').\
      and_raise_error(Puppet::ParseError, /Wrong number of arguments/)
  end

  context 'is_service_default' do
    it 'with <SERVICE DEFAULT>' do
      is_expected.to run.with_params('<SERVICE DEFAULT>').and_return(true)
    end

    it 'with string != <SERVICE DEFAULT>' do
      is_expected.to run.with_params('a value').and_return(false)
    end

    it 'with array' do
      is_expected.to run.with_params([1,2,3]).and_return(false)
    end

    it 'with hash' do
      is_expected.to run.with_params({'foo' => 'bar'}).and_return(false)
    end

    it 'with integer' do
      is_expected.to run.with_params(1234).and_return(false)
    end

    it 'with boolean' do
      is_expected.to run.with_params(false).and_return(false)
    end
  end
end