Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. # This file contains og initialization code for all tests.
  2. # This way you only change the parameters in one file in
  3. # order to run all the tests for many stores.
  4. #
  5. # Current store choices are
  6. # :mysql :postgresl :sqlite :kirby :memory
  7.  
  8. # CHANGE THIS TO SETUP MOST TESTS
  9.  
  10. configA = :postgresql
  11.  
  12. # FOR MULTI-TESTS
  13.  
  14. configB = :sqlite
  15.  
  16. # SET THIS TO true TO ENABLE EXTRA DEBUG CODE
  17.  
  18. debug = false
  19.  
  20. # TO TEST AGAINST AN INSTALLATION OF OG INSTEAD THIS LOCAL
  21. # DISTRIBUTION, SET THE FOLLOWING TO true.
  22.  
  23. test_against_installation = false
  24.  
  25.  
  26. #--------------------------------------------------------------
  27. # DO NOT CHANGE ANYTHING BELOW THIS LINE
  28.  
  29. unless test_against_installation
  30. $:.unshift File.expand_path( File.join( File.dirname(__FILE__), '..', '..', 'lib' ) )
  31. end
  32.  
  33. $DBG = debug
  34.  
  35. og_mysql = {
  36. :destroy => true,
  37. :store => :mysql,
  38. :user => 'root',
  39. :name => 'test',
  40. # :password => 'gmrulez',
  41. # :socket => '/var/run/mysqld/mysqld.sock'
  42. }
  43.  
  44. og_postgresql = {
  45. :destroy => true,
  46. :store => :postgresql,
  47. :user => `whoami`.chomp,
  48. #:password => 'postgres',
  49. :name => 'test'
  50. }
  51.  
  52. og_sqlite = {
  53. :destroy => true,
  54. :store => :sqlite,
  55. :name => 'test'
  56. }
  57.  
  58. og_kirby = {
  59. :destroy => true,
  60. :store => :kirby,
  61. :name => 'test',
  62. :embedded => true
  63. }
  64.  
  65. og_memory = {
  66. :store => :memory,
  67. :name => :test,
  68. :destroy => true
  69. }
  70.  
  71. # This sets the common global vars to be used by the tests.
  72.  
  73. eval %{
  74. @og_config1 = og_config = og_#{configA}
  75. @og_config2 = og_#{configB}
  76. }
  77.  
  78. require 'stringio'
  79. require 'rubygems'
  80. require Dir.pwd.gsub(%r(^(#{ENV['HOME']}/darcs/.*?)/.*?$), '\1/glycerin')
  81. require 'glue'
  82. require 'glue/logger'
  83. require 'og'
  84.  
  85. Logger.get.level = Logger::WARN unless $DBG
  86.  
  87. $og1 ||= eval %{ lambda do
  88. Og.setup(#{@og_config1.inspect})
  89. end
  90. }
  91. def $og1.method_missing(meth, *args, &block)
  92. call
  93. end
  94.  
  95. $og2 ||= eval %{ lambda do
  96. Og.setup(#{@og_config2.inspect})
  97. end
  98. }
  99. def $og2.method_missing(meth, *args, &block)
  100. call
  101. end
  102.  
  103.  
  104. Og.thread_safe = false if Og.thread_safe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement