Sha256: 14bbfd04eee4d78d948c64de51140da5176a08d7f2ebb643b2b880c3b364f19f

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

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

require 'active_model/better_errors'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

def migrate_test_db
  ActiveRecord::Base.connection.create_table(:users) do |t|
    t.string :first_name
    t.string :last_name
    t.string :email
  end
  ActiveRecord::Base.connection.create_table(:rulers) do |t|
    t.int :length
  end
end

RSpec.configure do |config|
  config.before(:all) do
    ActiveRecord::Base.establish_connection(
      adapter: 'sqlite3',
      database: ':memory:')
    migrate_test_db
  end
end

class String
  def ==(other)
    return super other.to_s if other.is_a? ActiveModel::ErrorCollecting::ErrorMessage
    super
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
instructure-active_model-better_errors-1.6.3.rails2.5 spec/spec_helper.rb
instructure-active_model-better_errors-1.6.3.rails2.4 spec/spec_helper.rb