Unit tests fail with acts_as_paranoid

I thought I had things set up right but now I’m not certain. I
installed the acts_as_paranoid plugin, added acts_as_paranoid just
under my class definition:

class Foo < ActiveRecord::Base
acts_as_paranoid
.
.
.
end

…and added “require_gem ‘acts_as_paranoid’” to the bottom of my
environment.rb.

The problem is when I run my unit tests I get a mess of errors similar
to this one:

  1. Error:
    test_destroy(CodeAlertResultTest):
    NoMethodError: undefined method scoped_methods=' for Foo:Class /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/ active_record/base.rb:1129:inmethod_missing’
    /usr/lib64/ruby/gems/1.8/gems/acts_as_paranoid-0.3.1/lib/
    acts_as_paranoid.rb:125:in with_deleted_scope' /usr/lib64/ruby/gems/1.8/gems/acts_as_paranoid-0.3.1/lib/ acts_as_paranoid.rb:81:infind’
    /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/
    active_record/fixtures.rb:401:in find' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/ active_record/fixtures.rb:478:incode_alert_results’
    ./test/unit/foo_test.rb:7:in setup_without_fixtures' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/ active_record/fixtures.rb:548:insetup’

Every unit test fails with this “undefined method `scoped_methods=’
for Foo:Class” error. This is my first time working with AAP so I’m
not sure what’s going on. Any advice and suggestions are appreciated.

Thanks in advance!
-Jason

Jason,

No need to require_gem ‘acts_as_paranoid’ in your environment.rb.
It’s not a gem, it’s a plugin and will be automatically loaded into
the environment.


Zack C.
http://depixelate.com

On 3/20/07, Zack C. [email protected] wrote:

Jason,

No need to require_gem ‘acts_as_paranoid’ in your environment.rb.
It’s not a gem, it’s a plugin and will be automatically loaded into
the environment.

The gem is ancient! My rubyforge script broke a long time ago, (gems
are such a pain to push automatically), and then this neat new ‘rails
plugin’ feature came out, and I haven’t looked back since :slight_smile:


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

Did you install the plugin?


Zack C.
http://depixelate.com

On Mar 20, 4:19 pm, “Rick O.” [email protected] wrote:

The gem is ancient! My rubyforge script broke a long time ago, (gems
are such a pain to push automatically), and then this neat new ‘rails
plugin’ feature came out, and I haven’t looked back since :slight_smile:


Rick O.http://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.com

Thanks for the tips. I removed the require_gem line from
environment.rb but now I’m getting a method_missing error:

/usr/bin/ruby -Ilib:test “/usr/lib64/ruby/gems/1.8/gems/rake-0.7.1/lib/
rake/rake_test_loader.rb” “test/unit/foo_test.rb” “test/unit/
foo_result_test.rb” “test/unit/foo_searchterm_test.rb”
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
base.rb:1129:in method_missing': undefined local variable or method acts_as_paranoid’ for Foo:Class (NameError)
from /home/jfrankovitz/svn/working/incubator/scaffolded/
code_alerts/config/…/app/models/foo.rb:2
from /usr/lib64/ruby/vendor_ruby/1.8/rubygems/
custom_require.rb:27:in gem_original_require' from /usr/lib64/ruby/vendor_ruby/1.8/rubygems/ custom_require.rb:27:in require’
from /usr/lib64/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:147:in require' from /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/ active_record/fixtures.rb:463:in require_fixture_classes’
from /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/
active_record/fixtures.rb:459:in each' from /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/ active_record/fixtures.rb:459:in require_fixture_classes’
from /usr/lib64/ruby/gems/1.8/gems/activerecord-1.14.4/lib/
active_record/fixtures.rb:454:in fixtures' from ./test/unit/foo_test.rb:4 from /usr/lib64/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/ rake_test_loader.rb:5:in load’
from /usr/lib64/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/
rake_test_loader.rb:5
from /usr/lib64/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/
rake_test_loader.rb:5:in `each’
from /usr/lib64/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/
rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/usr/bin/ruby -Ilib:test "/usr/lib64/
ruby/…]

Any idea what else might be missing here?

Thanks!
-Jason