Sha256: 3c0fcbf1f72c76263531a4862b24a729a657643cb3e52d950e8867925798ab5b

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 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'

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("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

8 entries across 8 versions & 2 rubygems

Version Path
beef-acts_as_content_node-0.1.6 test/test_helper.rb
acts_as_content_node-0.1.13 test/test_helper.rb
acts_as_content_node-0.1.12 test/test_helper.rb
acts_as_content_node-0.1.11 test/test_helper.rb
acts_as_content_node-0.1.10 test/test_helper.rb
acts_as_content_node-0.1.9 test/test_helper.rb
acts_as_content_node-0.1.8 test/test_helper.rb
acts_as_content_node-0.1.7 test/test_helper.rb