# require File.dirname(__FILE__) + '/../../../../spec/spec_helper' require 'rubygems' require 'activerecord' require 'spec' module Spec::Example::ExampleGroupMethods 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_DEFAULT_LOGGER = Logger.new(File.join(File.dirname(__FILE__), "debug.log")) load(File.dirname(__FILE__) + '/schema.rb') $: << File.join(File.dirname(__FILE__), '..', 'lib') require File.join(File.dirname(__FILE__), '..', 'init') # let's run the tests with non-default table names. class Tag set_table_name "v2_tags" end class Tagging set_table_name "v2_taggings" end 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