Acts_as_taggable tests appear to rely on special database se

Hi,

I’ve posted this to rubyforge, but I thought I’d post here as well in
case anyone outside the acts_as_taggable project has experienced this.

I’m trying to run the acts_as_taggable unit tests. I found I had to
create various tables, and even once I had created them all I still got
some errors.

Errors and required tables below and at:
http://rubyforge.org/tracker/index.php?func=detail&aid=3497&group_id=923&atid=3629

I was wondering if I might be able to get some input on how to run these
tests properly. It would be nice if the tests could run completely
standalone. I’m hoping to submit a patch that allows the “name” column
on the tag table to be adjusted.

CHEERS> SAM

  1. Failure:
    test_find_related_tags(ActAsTaggableTest)
    [test/acts_as_taggable_test.rb:216]:
    <2> expected but was
    <1>.

  2. Error:
    test_find_tagged_with_on_subclasses(ActAsTaggableTest):
    NoMethodError: undefined method tag' for nil:NilClass test/acts_as_taggable_test.rb:223:in test_find_tagged_with_on_subclasses’

  3. Failure:
    test_tag_cloud(ActAsTaggableTest) [test/acts_as_taggable_test.rb:318]:
    <9> expected but was
    <11>.

  4. Error:
    test_tagging_with_join_model(ActAsTaggableTest):
    NoMethodError: undefined method tag' for nil:NilClass test/acts_as_taggable_test.rb:106:in test_tagging_with_join_model’

  5. Error:
    test_with_non_defaults(ActAsTaggableTest):
    NoMethodError: undefined method tag_names' for nil:NilClass test/acts_as_taggable_test.rb:342:in test_tagging’
    test/acts_as_taggable_test.rb:91:in `test_with_non_defaults’

Additional tables required by tests:

DROP TABLE IF EXISTS companies;
CREATE TABLE IF NOT EXISTS companies (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL default ‘’,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS posts;
CREATE TABLE IF NOT EXISTS posts (
id int(11) NOT NULL auto_increment,
title varchar(255) NOT NULL default ‘’,
respond_to varchar(255) NOT NULL default ‘’,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS topics;
CREATE TABLE IF NOT EXISTS topics (
id int(11) NOT NULL auto_increment,
title varchar(255) NOT NULL default ‘’,
approved tinyint(4) default NULL,
replies_count int(11) default NULL,
content varchar(255) default NULL,
written_on datetime default NULL,
parent_id int(11) default NULL,
author_name varchar(255) default NULL,
bonus_time datetime default NULL,
author_email_address varchar(255) default NULL,
last_read date default NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Sam,

The acts_as_taggable( ) plugin relies
on the poly-morphic associations feature
of ActiveRecord, which was added
after Rails 1.0. You will need to do a
‘rake freeze_edge’ in the application you
want to use the taggable plugin with.
This will download edge rails into your
vendor folder. Your application will
then use the rails version in your vendor
folder automatically rather than the
version installed on the server you are
using.

Hi John,

I’m interested to hear that, because my acts_as_taggable gem appears to
work fine with my 0.14.3 rails.

I don’t know that I am using a plugin as such. Acts_as_taggable works
just fine.

I checked out the acts_as_taggable source from rubyforge and got a set
of tests that rely on some particular tables being present. The basic
tables are created by the acts_as_taggable_test.rb, but there are 3
(companies, posts and topics) not created by the tests, meaning that the
acts_as_taggable tests will not run standalone.

I don’t think that switching to edge rails will magically make those
tables appear when I run the acts_as_taggable tests.

Many thanks.

CHEERS> SAM

there are two act_as_taggable plugins:

one is a gem from rubyforge and the other is a plugin by DHH form rails
source repository