ruby-on-rails – 升级到Rspec 3后,错误“符号与模块失败的比较”

我刚从Rspec 2.99升级到Rspec 3,我的某些测试出现以下错误.
Failure/Error: Unable to find matching line from backtrace
ArgumentError:
  comparison of Symbol with Module Failed

我有以下控制器测试

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

任何想法可能导致错误

解决方法

在描述之后不能使用符号.你需要更换
describe :index do

describe 'index' do

然而,您可以使用符号作为标签,例如…

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

现在运行测试时,您只能使用某个标签来定位测试.

$rspec --tag awesome

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...