# "NoMethodError" while running Rake

**URL:** <https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521>\
**Category:** Rails\
**Created:** [December 21, 2009, 5:39am UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521 "2009-12-21T05:39:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 5:39am UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/1 "2009-12-21T05:39:34Z")

</div>

Hi All,

I was able to match the development database and migration will when  
running rake db:migrate

I am trying to understand the error logs generated when running rake.

$ rake  
(in /home/user/projects/emporium)  
/usr/bin/ruby1.8 -I"lib:test" “/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake/rake\_test\_loader.rb” “test/unit/author\_test.rb” “test/unit/  
helpers/about\_helper\_test.rb”  
./test/unit/author\_test.rb:4: undefined method `fixtures' for AuthorTest:Class (NoMethodError) from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/ rake_test_loader.rb:5:in `load’  
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/  
rake\_test\_loader.rb:5  
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/  
rake\_test\_loader.rb:5:in `each’  
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/  
rake\_test\_loader.rb:5  
/usr/bin/ruby1.8 -I"lib:test" “/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake/rake\_test\_loader.rb” “test/functional/  
about\_controller\_test.rb”  
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/  
rake\_test\_loader  
Started

Now I am not sure anymore if I was not able to define the fixtures or  
where should it be corrected.

D

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 9:37am UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/2 "2009-12-21T09:37:49Z")

</div>

On Dec 21, 4:38 am, dwhitekiss [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,

> Now I am not sure anymore if I was not able to define the fixtures or  
> where should it be corrected.

What does author\_test.rb look like ? (Additionally these days you  
might as well just stick fixtures :all in test\_helper.rb rather than  
specifying them in individual test files)

Fred

> D

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 3:27pm UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/3 "2009-12-21T15:27:15Z")

</div>

On Dec 21, 11:17 am, dwhitekiss [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> _author\_test.rb_
> 
> require File.dirname( **FILE** ) + ‘/…/test\_helper’  
> class AuthorTest \< Test::Unit::TestCase  
> fixtures :authors

Pre Rails 2.3 rails used to add a bunch of methods to  
Test::Unit::TestCase (such as stuff to do with fixtures).  
Post Rails 2.3 it no longer does that. If you want your test cases to  
have access to rails specific stuff, your test cases should inherit  
from ActiveSupport::TestCase

Fred

> removed\_email\_address@domain.invalid\> wrote:
> 
> > removed\_email\_address@domain.invalid\<rubyonrails-talk%2Bunsubscrib removed\_email\_address@domain.invalid\>  
> > .  
> > For more options, visit this group at  
> > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/4 "2009-12-21T20:33:24Z")

</div>

Thanks Freddie - it worked.

There is another error which I am currently searching for answer but  
maybe  
you already have?

Processing ApplicationController#index (for 127.0.0.1 at 2009-12-22  
03:15:41) [GET]

ActionController::RoutingError (No route matches “/admin/author/new”  
with  
{:method=\>:get}):  
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’  
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start’  
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start’  
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start’  
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start’

Rendering rescues/layout (not\_found)

D

On Mon, Dec 21, 2009 at 10:26 PM, Frederick C. \<  
removed\_email\_address@domain.invalid\> wrote:

> Test::Unit::TestCase (such as stuff to do with fixtures).
> 
> > end
> > 
> > > > Now I am not sure anymore if I was not able to define the fixtures or  
> > > > –  
> > > > For more options, visit this group at  
> > > > For more options, visit this group at  
> > > > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 8:39pm UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/5 "2009-12-21T20:39:24Z")

</div>

Dwhitekiss Dwhitekiss wrote:

> _author\_test.rb_
> 
> require File.dirname( **FILE** ) + ‘/…/test\_helper’  
> class AuthorTest \< Test::Unit::TestCase  
> fixtures :authors

Rails fixtures are horrible things. Avoid them. Use Machinist or  
similar. Also consider RSpec instead of Test::Unit.

> def test\_name  
> author = Author.create(:first\_name =\> ‘Joel’,:last\_name =\>  
> ‘Spolsky’)  
> assert\_equal ‘Joel Spolsky’, author.name  
> end  
> end

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 10:36pm UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/6 "2009-12-21T22:36:20Z")

</div>

On Dec 21, 7:31 pm, dwhitekiss [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks Freddie - it worked.
> 
> There is another error which I am currently searching for answer but maybe  
> you already have?

That’s just rails’ equivalent of a 404.

Fred

> /usr/lib/ruby/1.8/webrick/server.rb:95:in `start’
> 
> > > ```
> > > assert_equal 'Joel Spolsky', author.name
> > > 
> > > ```
> > > 
> > > > > Now I am not sure anymore if I was not able to define the fixtures or  
> > > > > –  
> > > > > For more options, visit this group at  
> > > > > For more options, visit this group at  
> > > > > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![dwhitekiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea5d25/32.png) [@dwhitekiss](https://www.ruby-forum.com/u/dwhitekiss)\
**Post date:** [December 21, 2009, 12:19pm UTC](https://www.ruby-forum.com/t/nomethoderror-while-running-rake/180521/7 "2009-12-21T12:19:22Z")

</div>

_author\_test.rb_

require File.dirname( **FILE** ) + ‘/…/test\_helper’  
class AuthorTest \< Test::Unit::TestCase  
fixtures :authors  
def test\_name  
author = Author.create(:first\_name =\> ‘Joel’,:last\_name =\>  
‘Spolsky’)  
assert\_equal ‘Joel Spolsky’, author.name  
end  
end

On Mon, Dec 21, 2009 at 8:36 AM, Frederick C. \<  
removed\_email\_address@domain.invalid\> wrote:

> specifying them in individual test files)  
> To unsubscribe from this group, send email to  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
