File: has_module_spec.rb

package info (click to toggle)
puppet-module-extlib 7.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: ruby: 1,035; sh: 15; makefile: 10
file content (33 lines) | stat: -rw-r--r-- 895 bytes parent folder | download
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
# frozen_string_literal: true

require 'spec_helper'

describe 'extlib::has_module' do
  it { is_expected.not_to eq(nil) }
  it { is_expected.to run.with_params.and_raise_error(ArgumentError) }
  it { is_expected.to run.with_params('not_a_valid_module_name').and_raise_error(ArgumentError) }

  context 'modules on our module path' do
    [
      'puppet-extlib',
      'puppet/extlib',
      'puppetlabs/stdlib'
    ].each do |good_module_name|
      it "returns true for #{good_module_name}" do
        is_expected.to run.with_params(good_module_name).and_return(true)
      end
    end
  end

  context 'modules not on our module path' do
    it do
      is_expected.to run.with_params('puppet/nosuchmodule').and_return(false)
    end
  end

  context 'modules not in the right namespace' do
    it do
      is_expected.to run.with_params('puppet/stdlib').and_return(false)
    end
  end
end