Sha256: 768c3497ae036cf5bef97a4e697607b929e308820af1272bbe04fc54494a9aad

Contents?: true

Size: 914 Bytes

Versions: 1

Compression:

Stored size: 914 Bytes

Contents

require 'active_record'
require 'activeform-rails'
require 'database_cleaner'

ActiveRecord::Base.establish_connection(
  :adapter => "sqlite3",
  :database => ':memory:'
)

['CREATE TABLE categories(id INTEGER PRIMARY KEY, title, user_id)',
 'CREATE TABLE users(id INTEGER PRIMARY KEY, name)'].each do |sql|
  ActiveRecord::Base.connection.execute sql
end

class User < ActiveRecord::Base
  has_many :categories
end

class Category < ActiveRecord::Base
  belongs_to :user
end

RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end

# hide deprecation warnings, see http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning
I18n.config.enforce_available_locales = true

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeform-rails-0.0.3 spec/spec_helper.rb