NoMethodError fixtures for testcase

869 views
Skip to first unread message

Michael Ries

unread,
Oct 12, 2012, 2:55:31 PM10/12/12
to minites...@googlegroups.com
Hey Guys - 
Everytime I try to use fixtures in my test cases I get this error:
minitest_helper.rb:27:in `<class:TestCase>': undefined method `fixtures' for MiniTest::Rails::ActiveSupport::TestCase:Class (NoMethodError)
from /vagrant/test/minitest_helper.rb:25:in `<top (required)>'
from test/models/document_template_test.rb:1:in `require_relative'
from test/models/document_template_test.rb:1:in `<main>'

I uncommented this in my minitest_helper file:
class MiniTest::Rails::ActiveSupport::TestCase
  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
  fixtures :all

  # Add more helper methods to be used by all tests here...
end

Any ideas on how to get this working? I'm on rails 3.2.6 and minitest-rails 0.2 

Mike Moore

unread,
Oct 12, 2012, 3:19:50 PM10/12/12
to minites...@googlegroups.com
On Oct 12, 2012, at 12:55 PM, Michael Ries <mic...@riesd.com> wrote:

> Any ideas on how to get this working? I'm on rails 3.2.6 and minitest-rails 0.2

Do you have ActiveRecord in your app? If ActiveRecord isn't defined
then the fixture infrastructure isn't loaded.

Michael Ries

unread,
Oct 12, 2012, 3:35:39 PM10/12/12
to minites...@googlegroups.com
Curse my love of MongoDB!  We are using mongoid.  Sorry Mike, that was my ruby-newbie moment for the day. 

Mike Moore

unread,
Oct 12, 2012, 3:46:22 PM10/12/12
to minites...@googlegroups.com
On Fri, Oct 12, 2012 at 1:35 PM, Michael Ries <mic...@riesd.com> wrote:
Curse my love of MongoDB!

My thoughts exactly. ;)
 
We are using mongoid.  Sorry Mike, that was my ruby-newbie moment for the day. 

The fixture stuff is actually part of ActiveRecord. I've hidden part of that in minitest-rails. I think the default `test_helper.rb` file has all the fixture loading in it, not just the `fixtures :all` call.
Reply all
Reply to author
Forward
0 new messages