# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # see http://blog.markstarkman.com/blog/2013/01/23/using-sqlite-to-test-active-record-models/ require 'active_record' ActiveRecord::Base.establish_connection adapter: 'postgresql', database: 'similar_models' # ActiveRecord::Base.establish_connection adapter: 'mysql2', database: 'similar_models', username: 'test' # ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:' load 'support/schema.rb' require 'similar_models' require 'support/models' require 'database_cleaner' require 'byebug' DatabaseCleaner.strategy = :transaction # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus # Many RSpec users commonly either run the entire suite or an individual # file, and it's useful to allow more verbose output when running an # individual spec file. if config.files_to_run.one? # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). config.default_formatter = 'doc' end # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = 'random' config.before :each do DatabaseCleaner.start end config.after :each do DatabaseCleaner.clean end end