Sha256: 3aa57e2687c958abd97b3ddedf256b71e335921bbf9deb62d1bcd2c5893c8877

Contents?: true

Size: 1.11 KB

Versions: 30

Compression:

Stored size: 1.11 KB

Contents

Given(/^the OnceoverFormatter$/) do
  require 'rspec'
  require 'onceover/rspec/formatters'

  RSpec.configure do |c|
    # Create onceover settings to be accessed by formatters
    c.add_setting :onceover_tempdir
    c.add_setting :onceover_root
    c.add_setting :onceover_environmentpath
  
    c.onceover_tempdir         = "/Users/foo/git/controlrepo/.onceover"
    c.onceover_root            = "/Users/foo/git/controlrepo"
    c.onceover_environmentpath = "etc/puppetlabs/code/environments"
  end
  
  @formatter = OnceoverFormatter.new(STDOUT)
end

When(/^Puppet throws the error: "(.*)"$/) do |error|
  @error = error
end

Then(/^the error should parse successfully$/) do
  expect do
    @parsed_error = @formatter.parse_errors(@error)
  end.to_not raise_error
end

Then(/^it should find (\d+) errors?$/) do |number|
  expect(@parsed_error.length).to be(number.to_i)
end

Then(/^the parsed errors? should contain the following keys: (.*)$/) do |keys|
  # Split the keys into an array
  keys = keys.split(',').map(&:strip)
  @parsed_error.each do |error|
    keys.each do |k|
      expect(error).to have_key(k.to_sym)
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
onceover-4.0.0 features/step_definitions/formatter.rb
onceover-3.22.0 features/step_definitions/formatter.rb
onceover-3.21.0 features/step_definitions/formatter.rb
onceover-3.20.0 features/step_definitions/formatter.rb
onceover-3.19.2 features/step_definitions/formatter.rb
onceover-3.19.1 features/step_definitions/formatter.rb
onceover-3.19.0 features/step_definitions/formatter.rb
onceover-3.18.1 features/step_definitions/formatter.rb
onceover-3.18.0 features/step_definitions/formatter.rb
onceover-3.17.3 features/step_definitions/formatter.rb
onceover-3.17.2 features/step_definitions/formatter.rb
onceover-3.17.1 features/step_definitions/formatter.rb
onceover-3.17.0 features/step_definitions/formatter.rb
onceover-3.16.0 features/step_definitions/formatter.rb
onceover-3.15.2 features/step_definitions/formatter.rb
onceover-3.15.1 features/step_definitions/formatter.rb
onceover-3.15.0 features/step_definitions/formatter.rb
onceover-3.14.1 features/step_definitions/formatter.rb
onceover-3.14.0 features/step_definitions/formatter.rb
onceover-3.13.4 features/step_definitions/formatter.rb