Sha256: 666a7beb8b2a52a349251bd0d615d531071edc7f186a0d8f2f0ede0a4cb1f330

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

require 'rspec-system/spec_helper'
require 'rspec-system-puppet/helpers'
require 'tempfile'

module LocalHelpers
  include RSpecSystem::Util

  def psql(psql_cmd, user = 'postgres', &block)
    psql = "psql #{psql_cmd}"
    shell("su #{shellescape(user)} -c #{shellescape(psql)}", &block)
  end
end

include RSpecSystemPuppet::Helpers

RSpec.configure do |c|
  # Project root for the firewall code
  proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

  # Enable colour in Jenkins
  c.tty = true

  # Include in our local helpers
  c.include ::LocalHelpers

  # Puppet helpers
  c.include RSpecSystemPuppet::Helpers
  c.extend RSpecSystemPuppet::Helpers

  # This is where we 'setup' the nodes before running our tests
  c.before :suite do
    # Install puppet
    puppet_install

    # Copy this module into the module path of the test node
    puppet_module_install(:source => proj_root, :module_name => 'postgresql')
    shell('puppet module install puppetlabs/stdlib')
    shell('puppet module install puppetlabs/firewall')
    shell('puppet module install puppetlabs/apt')
    shell('puppet module install ripienaar/concat')

    file = Tempfile.new('foo')
    begin
      file.write(<<-EOS)
---
:logger: noop
      EOS
      file.close
      rcp(:sp => file.path, :dp => '/etc/puppet/hiera.yaml')
    ensure
      file.unlink
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
freighthop-0.0.6 modules/postgresql/spec/spec_helper_system.rb
freighthop-0.0.5 modules/postgresql/spec/spec_helper_system.rb
freighthop-0.0.4 modules/postgresql/spec/spec_helper_system.rb
freighthop-0.0.3 modules/postgresql/spec/spec_helper_system.rb
freighthop-0.0.2 modules/postgresql/spec/spec_helper_system.rb
freighthop-0.0.1 modules/postgresql/spec/spec_helper_system.rb