Sha256: e01412d826f7fd6e8295ac5e6a0732313447524cac2a1c03c35f2ebc607409d9

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'bundler'
Bundler.setup

require 'with_model'
RSpec.configure do |config|
  config.extend WithModel

  config.warnings = true

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.mock_with :rspec do |c|
    c.syntax = :expect
  end
end

is_jruby = RUBY_PLATFORM == 'java'
adapter = is_jruby ? 'jdbcsqlite3' : 'sqlite3'

# WithModel requires ActiveRecord::Base.connection to be established.
# If ActiveRecord already has a connection, as in a Rails app, this is unnecessary.
require 'active_record'
ActiveRecord::Base.establish_connection(adapter: adapter, database: ':memory:')

if defined?(I18n) && I18n.respond_to?(:enforce_available_locales=)
  I18n.enforce_available_locales = true
end

if ENV['LOGGER']
  require 'logger'
  ActiveRecord::Base.logger = Logger.new($stdout)
end

module SpecHelper
  module RailsTestCompatability
    require 'minitest'
    include Minitest::Assertions

    def assertions
      @assertions ||= 0
    end

    def assertions=(value)
      @assertions = value
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
with_model-2.1.3 spec/spec_helper.rb
with_model-2.1.2 spec/spec_helper.rb
with_model-2.1.1 spec/spec_helper.rb
with_model-2.1.0 spec/spec_helper.rb