rake test fails

Posted by Pavel K. on Stack Overflow See other posts from Stack Overflow or by Pavel K.
Published on 2010-04-21T07:36:42Z Indexed on 2010/04/21 7:43 UTC
Read the original article Hit count: 152

Filed under:
|

i have a model (simplified)

class Myfile < ActiveRecord::Base
  validates_attachment_size :body, :less_than => AdminOptions.first.max_file_size.megabytes
end

max_file_size is defined in AdminOptions fixture, but when i try to run "rake test", i get:

 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing': undefined method `max_file_size' for nil:NilClass (NoMethodError)
 from /myapp/app/models/myfile.rb:1

if i run

ruby test/unit/myfile_test.rb

i get same mistake.
if i run:

RAILS_ENV=test rake db:load:fixtures
ruby test/unit/myfile_test.rb

tests execute properly.

if i try to

RAILS_ENV=test rake db:load:fixtures
rake test

it fails with same mistake.
does anyone know how to fix that?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about unit-testing