Generated behavior tests

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:

[email protected]:/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
[email protected]:/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:inmethod_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:insetup’

1 tests, 0 assertions, 0 failures, 1 errors
[email protected]:/var/www/home$

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

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

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

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs