File: split_spec.rb

package info (click to toggle)
ruby-rspec-puppet 4.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: ruby: 6,377; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 902 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
# frozen_string_literal: true

require 'spec_helper'

describe 'split' do
  it { is_expected.to run.with_params('aoeu', 'o').and_return(%w[a eu]) }
  it { is_expected.not_to run.with_params('foo').and_raise_error(Puppet::DevError) }

  expected_error = ArgumentError

  it { is_expected.to run.with_params('foo').and_raise_error(expected_error) }

  it { is_expected.to run.with_params('foo').and_raise_error(ArgumentError, /expects \d+ arguments/) }

  it { is_expected.to run.with_params('foo').and_raise_error(/expects \d+ arguments/) }

  it {
    expect do
      expect(subject).to run.with_params('foo').and_raise_error(/definitely no match/)
    end.to raise_error RSpec::Expectations::ExpectationNotMetError
  }

  context 'after including a class' do
    let(:pre_condition) { 'include ::sysctl::common' }

    it { is_expected.to run.with_params('aoeu', 'o').and_return(%w[a eu]) }
  end
end