Sha256: 775493c46c0a14052d77ff991b68361f43b7dbb78eb6b3f9f3c1e2d5afd4fb08

Contents?: true

Size: 1013 Bytes

Versions: 1

Compression:

Stored size: 1013 Bytes

Contents

require "rubygems"
require "ruby-debug"
gem 'test-unit'
require "test/unit"
require 'active_support'
require 'active_support/test_case'
require 'active_record'
require 'active_record/fixtures'
require 'shoulda'
require 'shoulda/active_record'

this = File.expand_path(File.dirname(__FILE__))

require File.expand_path(File.join(this, '/../lib/acts-as-joinable'))

ActsAsJoinable.models = Dir["#{this}/../app/models/*.rb"].collect { |f| File.basename f, '.rb' }

Dir["#{this}/lib/*"].each { |c| require c if File.extname(c) == ".rb" }

ActiveRecord::Base.class_eval do
  def self.detonate
    all.map(&:destroy)
  end
end

ActiveSupport::TestCase.class_eval do
  
  def create_models(parent = 1, child = 2)
    parent.times do |i|
      post = Post.create!(:title => "title-#{i.to_s}")
      child.times do |j|
        position = (i + 1) * (j + 1)
        asset = Asset.create!(:title => "asset-title-#{position.to_s}")
        tag   = Tag.create!(:name => "tag-name-#{position.to_s}")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts-as-joinable-0.0.1.5 test/test_helper.rb