# Acts\_as\_taggable tests appear to rely on special database se

**URL:** <https://www.ruby-forum.com/t/acts-as-taggable-tests-appear-to-rely-on-special-database-se/102392>\
**Category:** Rails\
**Created:** [February 8, 2006, 3:02pm UTC](https://www.ruby-forum.com/t/acts-as-taggable-tests-appear-to-rely-on-special-database-se/102392 "2006-02-08T15:02:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@samj](https://www.ruby-forum.com/u/samj)\
**Post date:** [February 8, 2006, 3:02pm UTC](https://www.ruby-forum.com/t/acts-as-taggable-tests-appear-to-rely-on-special-database-se/102392/1 "2006-02-08T15:02:59Z")

</div>

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](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 ;

---

<div class="post-metadata">

**Author:** ![samj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@samj](https://www.ruby-forum.com/u/samj)\
**Post date:** [February 8, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/acts-as-taggable-tests-appear-to-rely-on-special-database-se/102392/2 "2006-02-08T16:50:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![samj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@samj](https://www.ruby-forum.com/u/samj)\
**Post date:** [February 8, 2006, 5:26pm UTC](https://www.ruby-forum.com/t/acts-as-taggable-tests-appear-to-rely-on-special-database-se/102392/3 "2006-02-08T17:26:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@samj](https://www.ruby-forum.com/u/samj)\
**Post date:** [February 8, 2006, 5:38pm UTC](https://www.ruby-forum.com/t/acts-as-taggable-tests-appear-to-rely-on-special-database-se/102392/4 "2006-02-08T17:38:56Z")

</div>

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
