Sha256: d9a9bfb7dcfac4ba85dd9abf0ada2e5252b371ef243294fa584bcab5352af2ab

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require File.expand_path('../../lib/acts-as-taggable-on', __FILE__)
Bundler.require :test

module Rspec::Core::ExampleGroupSubject
  alias :context :describe
end

class Array
  def freq
    k=Hash.new(0)
    each {|e| k[e]+=1}
    k
  end
end

TEST_DATABASE_FILE = File.join(File.dirname(__FILE__), '..', 'test.sqlite3')

File.unlink(TEST_DATABASE_FILE) if File.exist?(TEST_DATABASE_FILE)
ActiveRecord::Base.establish_connection(
  "adapter" => "sqlite3", "database" => TEST_DATABASE_FILE
)

Rails.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))

ActiveRecord::Base.silence do
  ActiveRecord::Migration.verbose = false
  load(File.dirname(__FILE__) + '/schema.rb')
end

$: << File.join(File.dirname(__FILE__), '..', 'lib')

class TaggableModel < ActiveRecord::Base
  acts_as_taggable
  acts_as_taggable_on :languages
  acts_as_taggable_on :skills
  acts_as_taggable_on :needs, :offerings
end

class OtherTaggableModel < ActiveRecord::Base
  acts_as_taggable_on :tags, :languages
  acts_as_taggable_on :needs, :offerings
end

class InheritingTaggableModel < TaggableModel
end

class AlteredInheritingTaggableModel < TaggableModel
  acts_as_taggable_on :parts
end

class TaggableUser < ActiveRecord::Base
  acts_as_tagger
end

class UntaggableModel < ActiveRecord::Base
end

def clean_database!
  $debug = false
  models = [Tag, Tagging, TaggableModel, OtherTaggableModel, InheritingTaggableModel,
            AlteredInheritingTaggableModel, TaggableUser]
  models.each do |model|
    model.destroy_all
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
simonwh-acts-as-taggable-on-2.0.0.pre1 spec/spec_helper.rb
acts-as-taggable-on-2.0.0.pre1 spec/spec_helper.rb