Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error `comparison of Symbol with Module failed` after upgrading to Rspec 3

I just upgraded from Rspec 2.99 to Rspec 3 and am getting the following error for some of my tests.

Failure/Error: Unable to find matching line from backtrace
ArgumentError:
  comparison of Symbol with Module failed

I have the following controller test

require 'spec_helper'

describe PeopleController, type: :controller do
  subject { response }

  describe :index do
    before { get :index }

    it { should_not be_success }
    it { should have_http_status '401' }
  end
end

Any idea what might be causing the error?

like image 550
Ryan Avatar asked Jun 04 '14 17:06

Ryan


1 Answers

You can't use symbols after describe anymore. You need to replace

describe :index do

with

describe 'index' do

You are however able to use symbols as tags, for example...

describe 'index', :awesome do
  ...
end

Now when running the tests you can target only tests with a certain tag.

$ rspec --tag awesome
like image 96
Ryan Avatar answered Sep 30 '22 19:09

Ryan