spec_helper.rb 1.1 KB

123456789101112131415161718192021222324252627282930
  1. $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
  2. $LOAD_PATH.unshift(File.dirname(__FILE__))
  3. require 'rails'
  4. require 'mongoid'
  5. require 'dm-core'
  6. require 'kaminari'
  7. require 'database_cleaner'
  8. # Ensure we use 'syck' instead of 'psych' in 1.9.2
  9. # RubyGems >= 1.5.0 uses 'psych' on 1.9.2, but
  10. # Psych does not yet support YAML 1.1 merge keys.
  11. # Merge keys is often used in mongoid.yml
  12. # See: http://redmine.ruby-lang.org/issues/show/4300
  13. if RUBY_VERSION >= '1.9.2'
  14. YAML::ENGINE.yamler = 'syck'
  15. end
  16. require 'fake_gem'
  17. require 'fake_app'
  18. require 'rspec/rails'
  19. # Requires supporting files with custom matchers and macros, etc,
  20. # in ./support/ and its subdirectories.
  21. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
  22. RSpec.configure do |config|
  23. config.mock_with :rr
  24. config.before :all do
  25. # ActiveRecord::Base.connection.execute 'CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))' unless ActiveRecord::Base.connection.table_exists? 'users'
  26. CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'users'
  27. end
  28. end