Sha256: 734380b5c31fe3662463b1a917b04113a69741d2c820c24eb62351266ec5d141

Contents?: true

Size: 1.02 KB

Versions: 588

Compression:

Stored size: 1.02 KB

Contents

module PuppetSpec::Pops
  extend RSpec::Matchers::DSL

  # Checks if an Acceptor has a specific issue in its list of diagnostics
  matcher :have_issue do |expected|
    match do |actual|
      actual.diagnostics.index { |i| i.issue == expected } != nil
    end
    failure_message do |actual|
      "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to contain issue #{expected.issue_code}"
    end
    failure_message_when_negated do |actual|
      "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to not contain issue #{expected.issue_code}"
    end
  end

  # Checks if an Acceptor has any issues
  matcher :have_any_issues do
    match do |actual|
      !actual.diagnostics.empty?
    end
    failure_message do |actual|
      'expected Acceptor[] to contain at least one issue'
    end
    failure_message_when_negated do |actual|
      "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to not contain any issues"
    end
  end
end

Version data entries

588 entries across 588 versions & 1 rubygems

Version Path
puppet-8.2.0 spec/lib/puppet_spec/pops.rb
puppet-8.2.0-x86-mingw32 spec/lib/puppet_spec/pops.rb
puppet-8.2.0-x64-mingw32 spec/lib/puppet_spec/pops.rb
puppet-8.2.0-universal-darwin spec/lib/puppet_spec/pops.rb
puppet-7.26.0 spec/lib/puppet_spec/pops.rb
puppet-7.26.0-x86-mingw32 spec/lib/puppet_spec/pops.rb
puppet-7.26.0-x64-mingw32 spec/lib/puppet_spec/pops.rb
puppet-7.26.0-universal-darwin spec/lib/puppet_spec/pops.rb
puppet-7.25.0 spec/lib/puppet_spec/pops.rb
puppet-7.25.0-x86-mingw32 spec/lib/puppet_spec/pops.rb
puppet-7.25.0-x64-mingw32 spec/lib/puppet_spec/pops.rb
puppet-7.25.0-universal-darwin spec/lib/puppet_spec/pops.rb
puppet-8.1.0 spec/lib/puppet_spec/pops.rb
puppet-8.1.0-x86-mingw32 spec/lib/puppet_spec/pops.rb
puppet-8.1.0-x64-mingw32 spec/lib/puppet_spec/pops.rb
puppet-8.1.0-universal-darwin spec/lib/puppet_spec/pops.rb
puppet-8.0.1 spec/lib/puppet_spec/pops.rb
puppet-8.0.1-x86-mingw32 spec/lib/puppet_spec/pops.rb
puppet-8.0.1-x64-mingw32 spec/lib/puppet_spec/pops.rb
puppet-8.0.1-universal-darwin spec/lib/puppet_spec/pops.rb