Sha256: 55c2abf5dd167db66e2f7c8e564a042e32cb6afe90a4200c108d6717d24ff798

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'rubygems'
require 'active_record'
require 'yaml'
require 'spec'
require File.dirname(__FILE__) + '/../init.rb'

# Establish database connection.
config = YAML::load(File.open(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.establish_connection(config['test'])
load(File.dirname(__FILE__) + "/schema.rb")

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

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
  has_one  :account, :null_object => false
  has_one  :address, :null_object => true
end

class Comment < ActiveRecord::Base
  belongs_to :author, :null_object => true
end

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

class Session < ActiveRecord::Base
  belongs_to :author
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord_null_object-0.2.0 spec/spec_helper.rb