ruby – 在运行时为RSpec测试文件递归glob
发布时间:2020-12-17 02:41:32 所属栏目:百科 来源:网络整理
导读:我有一套RSpec测试,我想在以下层次结构下进行分组: tests/ featA/ t1.rb t2.rb featB/ t3.rb 但是当我跑 $rspec tests 我得到以下内容: rspec testsNo examples were matched. Perhaps {:unless=#Proc:0x00007f318919cc08@/usr/lib/ruby/gems/1.8/gems/rsp
我有一套RSpec测试,我想在以下层次结构下进行分组:
tests/ featA/ t1.rb t2.rb featB/ t3.rb 但是当我跑 $rspec tests 我得到以下内容: rspec tests No examples were matched. Perhaps {:unless=>#<Proc:0x00007f318919cc08@/usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:51>,:if=>#<Proc:0x00007f318919cdc0@/usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:50>} is excluding everything? Finished in 0.00003 seconds 0 examples,0 failures 我觉得我很生气,但是似乎没有办法让RSpec递归地为测试文件生成?这个功能是否存在? 编辑: 我有一个解决方法: $rspec `find tests -name "*.rb"` 但我怀疑我不应该这样做.我对吗? 解决方法
你已经暴露了我的疏忽!在rspec-1中,你可以这样说:
spec test --pattern "**/*.rb" 但是rspec-2中缺少–pattern选项.我刚添加它(in development),它将包含在rspec-2.6.0版本中. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |