"NoMethodError" while running Rake

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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

On Dec 21, 4:38 am, dwhitekiss [email protected] 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

On Dec 21, 11:17 am, dwhitekiss [email protected] 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

[email protected]> wrote:

[email protected]<rubyonrails-talk%2Bunsubscrib [email protected]>
.
For more options, visit this group at
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

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. <
[email protected]> 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.

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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

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
[email protected]

On Dec 21, 7:31 pm, dwhitekiss [email protected] 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.

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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

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. <
[email protected]> wrote:

specifying them in individual test files)
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.