Sha256: 3adb16fa0d493f770e0f336e8c8b99effe5b72c61450be8a23e85909d68ed590

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

require 'rubygems'
require 'bundler/setup'
require 'active_record'
require 'yaml'
require 'rspec'
require 'rspec/its'

I18n.enforce_available_locales = true if I18n.respond_to? :enforce_available_locales=

require 'support/coverage_loader'

require 'activerecord_null_object'

# Fixes 'address'.singularize  # => 'addres'
ActiveSupport::Inflector.inflections do |inflect|
  inflect.singular(/ess$/i, 'ess')
end

DB_FILE = 'tmp/test_db'
FileUtils.mkdir_p File.dirname(DB_FILE)
FileUtils.rm_f DB_FILE

ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => DB_FILE

load('spec/schema.rb')

class Account < ActiveRecord::Base
end

class Address < ActiveRecord::Base
end

class Profile < ActiveRecord::Base
end

# Define ActiveRecord classes to use while testing.
class Author < ActiveRecord::Base
  has_many :posts
  has_many :comments
  has_many :sessions
  has_one  :profile
  if ::ActiveRecord::VERSION::MAJOR == 4
    has_one :account, -> {order :created_at}, :null_object => false
  else
    has_one :account, :null_object => false
  end
  has_one  :address, :null_object => true
end

class Comment < ActiveRecord::Base
  if ::ActiveRecord::VERSION::MAJOR == 4
    belongs_to :author, -> {order :name}, :null_object => true
  else
    belongs_to :author, :null_object => true
  end
end

class Post < ActiveRecord::Base
  belongs_to :author, :null_object => false
end

class Session < ActiveRecord::Base
  belongs_to :author
end

RSpec.configure do |config|
  config.raise_errors_for_deprecations!
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord_null_object-0.8.0 spec/spec_helper.rb
activerecord_null_object-0.7.0 spec/spec_helper.rb
activerecord_null_object-0.6.0 spec/spec_helper.rb
activerecord_null_object-0.5.0 spec/spec_helper.rb
activerecord_null_object-0.4.0 spec/spec_helper.rb