Sha256: 66df7538e72d44fa887d57b7c90ebd48e67453c9c2d5865372ea14666f1aa353

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

require 'rubygems'
require 'test/unit'
require 'active_record'
require 'shoulda/rails'
require 'factory_girl'
require 'faker'

# Setting this makes parameterize work
$KCODE = 'UTF8'

# Makes TimeZone work
Time.zone = 'UTC'

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

RAILS_DEFAULT_LOGGER = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
ActiveRecord::Base.logger = RAILS_DEFAULT_LOGGER

require "acts_as_content_node/content_node"
require "acts_as_content_node/publishable"
require "acts_as_content_node/permalinks"

ActiveRecord::Base.send :include, Beef::Acts::ContentNode
ActiveRecord::Base.send :include, Beef::Acts::Publishable

ActiveRecord::Base.configurations = YAML::load(IO.read(File.dirname(__FILE__) + "/database.yml"))
ActiveRecord::Base.establish_connection(ENV["DB"] || "sqlite3mem")
ActiveRecord::Migration.verbose = false
load(File.join(File.dirname(__FILE__), "schema.rb"))

class ContentNode < ActiveRecord::Base
  acts_as_content_node
end

class User < ActiveRecord::Base
  before_save :set_permalink
  
  def set_permalink
    self.permalink = name.parameterize
  end
end

Factory.define(:content_node) do |content_node|
  content_node.title               {Faker::Lorem.words(5).join(' ')}
  content_node.description         {Faker::Lorem.sentence}
  content_node.body                {Faker::Lorem.paragraphs.join}
  content_node.association :created_by, :factory => :user
end

Factory.define :user do |user|
  user.name                  { Faker::Name.name }
end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
beef-acts_as_content_node-0.1.4 test/test_helper.rb
beef-acts_as_content_node-0.1.5 test/test_helper.rb