undefined method `task' for #<Spec::Rake::SpecTask

Any idea to fix this (I am using Rails 2.3.11):

$ heroku rake db:migrate --app myapp --trace
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
undefined method `task' for #<Spec::Rake::SpecTask:0x7f690b4eecf8>
/app/lib/tasks/rspec.rake:28:in `initialize'
/app/lib/tasks/rspec.rake:58:in `new'
/app/lib/tasks/rspec.rake:58
/app/.bundle/gems/ruby/1.8/gems/activesupport-2.3.11/lib/
active_support
/dependencies.rb:171:in `load_without_new_constant_marking'
/app/.bundle/gems/ruby/1.8/gems/activesupport-2.3.11/lib/
active_support
/dependencies.rb:171:in `load'

/app/.bundle/gems/ruby/1.8/gems/activesupport-2.3.11/lib/
active_support
/dependencies.rb:547:in `new_constants_in'

/app/.bundle/gems/ruby/1.8/gems/activesupport-2.3.11/lib/
active_support
/dependencies.rb:171:in `load'

/app/.bundle/gems/ruby/1.8/gems/rails-2.3.11/lib/tasks/rails.rb:14

/app/.bundle/gems/ruby/1.8/gems/rails-2.3.11/lib/tasks/rails.rb:14:in
`each'

/app/.bundle/gems/ruby/1.8/gems/rails-2.3.11/lib/tasks/rails.rb:14

/app/Rakefile:10:in `require'

/app/Rakefile:10

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:
25:in `load'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:
25:in `load_rakefile'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
495:in `raw_load_rakefile'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
78:in `load_rakefile'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
129:in `standard_exception_handling'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
77:in `load_rakefile'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
61:in `run'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
129:in `standard_exception_handling'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:
59:in `run'

/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/bin/rake:31

/usr/ruby1.8.7/bin/rake:19:in `load'

/usr/ruby1.8.7/bin/rake:19

My Gemfile.lock

GEM
  remote: http://rubygems.org/
  specs:
    RedCloth (4.2.7)
    actionmailer (2.3.11)
      actionpack (= 2.3.11)
    actionpack (2.3.11)
      activesupport (= 2.3.11)
      rack (~> 1.1.0)
    activerecord (2.3.11)
      activesupport (= 2.3.11)
    activeresource (2.3.11)
      activesupport (= 2.3.11)
    activesupport (2.3.11)
    annotate (2.4.0)
    cells (3.3.5)
    configuration (1.2.0)
    crypt (1.1.4)
    daemons (1.1.3)
    eventmachine (0.12.10)
    exceptional (2.0.32)
      rack
    faker (0.3.0)
    heroku (2.2.4)
      launchy (>= 0.3.2)
      rest-client (~> 1.6.1)
      term-ansicolor (~> 1.0.5)
    heroku_san (1.2.0)
      heroku
      rails (>= 2)
    launchy (0.4.0)
      configuration (>= 0.0.5)
      rake (>= 0.8.1)
    lockfile (1.4.3)
    machinist (1.0.6)
    mime-types (1.16)
    mocha (0.9.12)
    mysql (2.8.1)
    mysql2 (0.3.2)
    pg (0.11.0)
    rack (1.1.2)
    rails (2.3.11)
      actionmailer (= 2.3.11)
      actionpack (= 2.3.11)
      activerecord (= 2.3.11)
      activeresource (= 2.3.11)
      activesupport (= 2.3.11)
      rake (>= 0.8.3)
    rake (0.8.7)
    rdoc (3.6.1)
    rest-client (1.6.3)
      mime-types (>= 1.16)
    ri_cal (0.8.8)
    rspec (1.3.2)
    rspec-rails (1.3.4)
      rack (>= 1.0.0)
      rspec (~> 1.3.1)
    sequel (3.20.0)
    sinatra (1.0)
      rack (>= 1.0)
    sqlite3 (1.3.3)
    sqlite3-ruby (1.3.3)
      sqlite3 (>= 1.3.3)
    taps (0.3.23)
      rack (>= 1.0.1)
      rest-client (< 1.7.0, >= 1.4.0)
      sequel (~> 3.20.0)
      sinatra (~> 1.0.0)
      sqlite3-ruby (~> 1.2)
    term-ansicolor (1.0.5)
    thin (1.2.11)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)

PLATFORMS
  ruby

DEPENDENCIES
  RedCloth (>= 4.0)
  annotate
  cells (= 3.3.5)
  crypt
  exceptional
  faker (= 0.3.0)
  heroku_san
  lockfile
  machinist
  mocha
  mysql
  mysql2
  pg
  rails (~> 2.3.11)
  rake (~> 0.8.7)
  rdoc
  ri_cal
  rspec-rails (= 1.3.4)
  taps
  thin

Afaik i’ve seen similar weird issues, although locally with rake 0.9.0, you might want to downgrade to 0.8.7…

Hi

I changed

gem 'rake', '~> 0.8.7'

to

gem 'rake', '0.8.7'

and it solved the issue

thank you

Hi

I changed

gem 'rake', '~> 0.8.7'

to

gem 'rake', '0.8.7'

and it solved the issue

thank you