ruby-on-rails – 升级到Rspec 3后,错误“符号与模块失败的比较
发布时间:2020-12-16 21:58:13 所属栏目:百科 来源:网络整理
导读:我刚从Rspec 2.99升级到Rspec 3,我的某些测试出现以下错误. Failure/Error: Unable to find matching line from backtraceArgumentError: comparison of Symbol with Module failed 我有以下控制器测试 require 'spec_helper'describe PeopleController,type
我刚从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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |