Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec Deprecated

I am working on a few tests and each time I am running them I receive the following warning:

DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.

C:/Sites/injixo/spec/views/me_home_spec.rb:1in 'require'

*Rspec is deprecated
*Rspec is the new top-level module in RSpec-2

I have the latest version 2.6.1 of RSpec installed so I am unsure why this warning is appearing. Can anyone shed some light on this matter and how I might go about removing it.

Thanks JP

like image 501
John Paul Mc Feely Avatar asked Jan 10 '12 16:01

John Paul Mc Feely


2 Answers

The problem is most likely in spec/spec_helper.rb, which is probably required by your spec. The top-level module is now called RSpec with a capital S. For your question, you must have typed some of the error message by hand instead of copy-and-pasting it. Your spec_helper should look something like this:

# spec/spec_helper.rb
RSpec.configure do |config|
    ...
end
like image 186
Rob Davis Avatar answered Oct 02 '22 16:10

Rob Davis


I came across this error by using guard. I simply had to change

guard 'rspec', :version => 2 do

to

guard 'rspec' do

in the Guardfile.

like image 32
Christoph Petschnig Avatar answered Oct 02 '22 16:10

Christoph Petschnig