Sha256: df60c6280b161ba6bb48bb4a2e6a1d29cfa7aa5fab61e61614dbe528f3affc4d

Contents?: true

Size: 805 Bytes

Versions: 78

Compression:

Stored size: 805 Bytes

Contents

# This just makes some nice things available at global scope, and for setup of
# tests to use a real fake database, rather than a fake stubs-that-don't-work
# version of the same.  Fun times.
def sqlite?
  if $sqlite.nil?
    begin
      require 'sqlite3'
      $sqlite = true
    rescue LoadError
      $sqlite = false
    end
  end
  $sqlite
end

def can_use_scratch_database?
  sqlite? and Puppet.features.rails?
end


# This is expected to be called in your `before :each` block, and will get you
# ready to roll with a serious database and all.  Cleanup is handled
# automatically for you.  Nothing to do there.
def setup_scratch_database
  Puppet[:dbadapter] = 'sqlite3'
  Puppet[:dblocation] = ':memory:'
  Puppet[:railslog] = PuppetSpec::Files.tmpfile('storeconfigs.log')
  Puppet::Rails.init
end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/lib/puppet_spec/database.rb
puppet-3.8.7-x86-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.7-x64-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.6 spec/lib/puppet_spec/database.rb
puppet-3.8.6-x86-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.6-x64-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.5 spec/lib/puppet_spec/database.rb
puppet-3.8.5-x86-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.5-x64-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.4 spec/lib/puppet_spec/database.rb
puppet-3.8.4-x86-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.4-x64-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.3 spec/lib/puppet_spec/database.rb
puppet-3.8.3-x86-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.3-x64-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.2 spec/lib/puppet_spec/database.rb
puppet-3.8.2-x86-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.2-x64-mingw32 spec/lib/puppet_spec/database.rb
puppet-3.8.1 spec/lib/puppet_spec/database.rb
puppet-3.8.1-x86-mingw32 spec/lib/puppet_spec/database.rb