44

When I do bundle exec rake -T (or bundle exec rake), I get deprecation warnings:

Andrews-Air:nabu agrimm$ bundle exec rake --trace -T
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
rake about                               # List versions of all Rails frameworks and the environment
[snip]

Although not really relevant, here's the Gemfile:

source 'https://rubygems.org'

gem 'rails', '~> 3.2.22.2'

gem 'mysql2'

group :assets do
  gem 'coffee-rails', '~> 3.2.1'
  gem 'compass-rails'

  gem 'therubyracer'
  gem 'libv8'

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'haml-rails'
gem 'to-csv', :require => 'to_csv'
gem 'kaminari'
gem 'oai'
gem 'analytical'

gem 'country-select'
gem 'activeadmin'
gem 'sass-rails',  '~> 3.2.3'
gem 'meta_search', '>= 1.1.0.pre'

gem 'devise', '2.2.3'
gem 'cancancan', '~> 1.12.0'

gem 'squeel'
gem 'nilify_blanks'

gem 'sunspot_rails'
gem 'sunspot_solr'

gem 'unicorn'

gem 'ruby-filemagic'

gem 'capistrano'
gem 'capistrano-ext'
gem 'capistrano-unicorn'

gem 'rollbar', '~> 2.8.3'
gem 'newrelic_rpm'

gem 'progress_bar'
gem 'paper_trail', '~> 2'
gem 'quiet_assets'
gem 'roo', '~> 2.1.0'
gem 'roo-xls', :github => 'roo-rb/roo-xls', :ref => '0a5ef88'
gem 'streamio-ffmpeg'
gem 'rake'

gem 'rmagick'

gem 'whenever', :require => false

group :development, :test do
  gem 'turn', '~> 0.8.3', :require => false
  gem 'rspec-rails', '~> 2.0'
  gem 'sextant'
  gem 'thin'

  gem 'spring'
  gem 'spring-commands-rspec'

  gem 'pry'
  gem 'pry-rails'

  gem 'letter_opener'

  gem 'guard-bundler'
  gem 'guard-rails'
  gem 'guard-rspec'
  gem 'guard-sunspot'

  gem 'rb-inotify', :require => RUBY_PLATFORM.include?('linux') ? 'rb-inotify' : false
  gem 'rb-fsevent', :require => RUBY_PLATFORM.include?('darwin') ? 'rb-fsevent' : false
end

group :development do
  gem 'annotate'
  gem 'binding_of_caller'
  gem 'better_errors'
  gem 'rubocop'
end

group :test do
  gem 'capybara'
  gem 'poltergeist'
  gem 'factory_girl_rails'
  gem 'database_cleaner'
  gem 'email_spec'
  gem 'launchy'
end

Doing a git grep -i last_comment indicates it's not in my code - presumably it's in a third-party gem.

How do I work out what causes the deprecation warnings?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338

5 Answers5

28

Try updating gem "rspec-rails", "~> 3.4.4", that resolved the deprecation warnings for me.

Chris Scott
  • 439
  • 4
  • 5
  • 2
    rspec-core 3.4.2 still had this warning for me. Updating to 3.4.4 resolved it. See https://github.com/rspec/rspec-core/issues/2210. – jwadsack Mar 25 '16 at 16:44
  • 5
    Gemfile: `gem 'rspec-rails', '~> 3.4.2'`, Console: `$ bundle update rspec rspec-rails` – blackchestnut Apr 06 '16 at 14:58
25

I find it easier modifying the the line from warn to raise in rake-11.1.0/lib/rake/task_manager.rb:10.

For me the offending gems are rspec (fixed in 3.4.4) and rubocop (fixed in 0.38.0).

Ken I.
  • 266
  • 2
  • 4
  • I have changed warn to raise in task_manger.rb, but I still can not use rake (db:migrate). I have also noticed that I have multiple rake versions in my gems directory, should I remove newer? – Alan Kis Mar 18 '16 at 19:41
  • 7
    Updating rspec-core to 3.4.4 & rspec-rails to 3.4.2 resolved it. – Richard_G Mar 19 '16 at 00:17
5

You can recursively grep your gems, with:

grep -r last_comment /path/to/gems
stefan0xC
  • 337
  • 5
  • 11
5

It is not rspec fault, the error comes from rake there was a commit a couple of weeks ago that added the warning, there was a follow up here.

Seems that Rspec already complies in using last_description over last_comment. If possible try to update to a newer version of rspec-core Gem, like @chris-scott suggested. I ran to do the trick

bundle update rspec-core

Necronet
  • 6,704
  • 9
  • 49
  • 89
5

As described in this post, you can do:

# application.rb
ActiveSupport::Deprecation.debug = true

This will give you full stack trace of deprecation.

Community
  • 1
  • 1
anthony
  • 640
  • 1
  • 10
  • 32