Rya*_*yan 9 rspec ruby-on-rails rspec-rails
我刚从Rspec 2.99升级到Rspec 3,我的一些测试得到以下错误.
Failure/Error: Unable to find matching line from backtrace
ArgumentError:
comparison of Symbol with Module failed
Run Code Online (Sandbox Code Playgroud)
我有以下控制器测试
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
Run Code Online (Sandbox Code Playgroud)
知道可能导致错误的原因吗?
Rya*_*yan 22
你不能再使用符号describe了.你需要更换
describe :index do
Run Code Online (Sandbox Code Playgroud)
同
describe 'index' do
Run Code Online (Sandbox Code Playgroud)
但是,您可以使用符号作为标记,例如......
describe 'index', :awesome do
...
end
Run Code Online (Sandbox Code Playgroud)
现在,在运行测试时,您只能使用特定标记来定位测试.
$ rspec --tag awesome
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1817 次 |
| 最近记录: |