# Generated behavior tests

**URL:** <https://www.ruby-forum.com/t/generated-behavior-tests/100901>\
**Category:** Radiant CMS\
**Created:** [August 1, 2006, 9:34pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901 "2006-08-01T21:34:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_MacAulay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@James\_MacAulay](https://www.ruby-forum.com/u/James_MacAulay)\
**Post date:** [August 1, 2006, 9:34pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901/1 "2006-08-01T21:34:51Z")

</div>

When I use script/generate to make a behavior, the default test fails  
right out of the box. It doesn’t seem to like the use of  
‘behavior\_id’ on Page, and I don’t really understand why. I’m working  
off of the svn trunk, with revision 87. Any thoughts as to why this  
is happening? Is it only me? I’ve made some changes to my  
istallation, but none that I would expect could affect something like  
this.

James

Here’s what it shows me exactly:

jmacaulay@ubuntu1:/var/www/home$ script/generate behavior blah  
exists app/behaviors/  
exists test/unit/behaviors/  
create app/behaviors/blah\_behavior.rb  
create test/unit/behaviors/blah\_behavior\_test.rb  
jmacaulay@ubuntu1:/var/www/home$ ruby test/unit/behaviors/  
blah\_behavior\_test.rb  
Loaded suite test/unit/behaviors/blah\_behavior\_test  
Started  
E  
Finished in 0.046515 seconds.

1. Error:  
test\_title\_tag(BlahBehaviorTest):  
NoMethodError: undefined method `behavior_id=' for #<Page:0xb73d34c8> /var/www/home/test/../config/../vendor/rails/activerecord/lib/ active_record/base.rb:1789:in`method\_missing’  
test/unit/behaviors/blah\_behavior\_test.rb:8:in  
`setup_without_fixtures' /var/www/home/test/../config/../vendor/rails/activerecord/lib/ active_record/fixtures.rb:548:in`setup’

1 tests, 0 assertions, 0 failures, 1 errors  
jmacaulay@ubuntu1:/var/www/home$

---

<div class="post-metadata">

**Author:** ![James\_MacAulay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@James\_MacAulay](https://www.ruby-forum.com/u/James_MacAulay)\
**Post date:** [August 3, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901/2 "2006-08-03T12:02:14Z")

</div>

James MacAulay wrote:

> When I use script/generate to make a behavior, the default test fails  
> right out of the box. It doesn’t seem to like the use of  
> ‘behavior\_id’ on Page, and I don’t really understand why. I’m working  
> off of the svn trunk, with revision 87. Any thoughts as to why this  
> is happening? Is it only me? I’ve made some changes to my  
> istallation, but none that I would expect could affect something like  
> this.

This works for me:

$ script/console  
Loading development environment.

> > Page.find(1).behavior\_id  
> > =\> “”

Does it work for you?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![James\_MacAulay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@James\_MacAulay](https://www.ruby-forum.com/u/James_MacAulay)\
**Post date:** [August 3, 2006, 12:47pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901/3 "2006-08-03T12:47:17Z")

</div>

On 2-Aug-06, at 12:09 AM | Aug 2, John W. Long wrote:

> $ script/console  
> Loading development environment.
> 
> > > Page.find(1).behavior\_id  
> > > =\> “”
> > 
> > >
> 
> Does it work for you?

Yes, it does.

James

---

<div class="post-metadata">

**Author:** ![James\_MacAulay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@James\_MacAulay](https://www.ruby-forum.com/u/James_MacAulay)\
**Post date:** [August 3, 2006, 12:47pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901/4 "2006-08-03T12:47:32Z")

</div>

It turns out that none of my tests are working. I thought maybe it  
was a database connection issue, but everything looks fine in that area.

James

---

<div class="post-metadata">

**Author:** ![James\_MacAulay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@James\_MacAulay](https://www.ruby-forum.com/u/James_MacAulay)\
**Post date:** [August 3, 2006, 12:49pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901/5 "2006-08-03T12:49:59Z")

</div>

James MacAulay wrote:

> It turns out that none of my tests are working. I thought maybe it  
> was a database connection issue, but everything looks fine in that area.

Did you setup the test database?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![James\_MacAulay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@James\_MacAulay](https://www.ruby-forum.com/u/James_MacAulay)\
**Post date:** [August 3, 2006, 1:09pm UTC](https://www.ruby-forum.com/t/generated-behavior-tests/100901/6 "2006-08-03T13:09:12Z")

</div>

Thanks, that was the problem. Silly me. The schema was there, but I  
didn’t notice that it was only at version 1. I don’t know why it was  
like that.

James
