forked from puppetlabs/puppet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request puppetlabs#497 from daniel-pittman/bug/2.7.x/activ…
…e-record-test-failures-with-3.2.1 Bug/2.7.x/active record test failures with 3.2.1
- Loading branch information
Showing
8 changed files
with
95 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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 | ||
dir = PuppetSpec::Files.tmpdir('puppet-sqlite') | ||
Puppet[:dbadapter] = 'sqlite3' | ||
Puppet[:dblocation] = (dir + 'storeconfigs.sqlite').to_s | ||
Puppet[:railslog] = '/dev/null' | ||
Puppet::Rails.init | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 5 additions & 18 deletions
23
spec/unit/indirector/facts/inventory_active_record_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters