Sha256: fb85ab61558869cf76369d01d251f9021dc58221b4a592739270b6ec601b3276

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'simplecov'
require 'simplecov-gem-profile'
SimpleCov.start "gem"

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'rspec'
require 'active_record'
require 'schema_plus_views'
require 'schema_dev/rspec'

SchemaDev::Rspec.setup

Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
  config.warnings = true
  config.around(:each) do |example|
    ActiveRecord::Migration.suppress_messages do
      ActiveRecord::Base.connection.tables.each do |table|
        ActiveRecord::Migration.drop_table table, force: :cascade
      end
      ActiveRecord::Base.connection.views.each do |view|
        ActiveRecord::Migration.drop_view view, force: :cascade
      end
      example.run
    end
  end
end

def apply_migration(config = {}, &block)
  ActiveRecord::Schema.define do
    instance_eval &block
  end
end

def build_migration(version: 5.0, &block)
  Class.new(::ActiveRecord::Migration[version]) do
    instance_eval &block
  end
end

SimpleCov.command_name "[ruby #{RUBY_VERSION} - ActiveRecord #{::ActiveRecord::VERSION::STRING} - #{ActiveRecord::Base.connection.adapter_name}]"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schema_plus_views-0.4.1 spec/spec_helper.rb
schema_plus_views-0.4.0 spec/spec_helper.rb