配置rspec以排除文件夹,除非明确指定rspec运行该文件夹
我想从rspec测试中排除文件夹,除非它被显式地作为命令行参数提供以运行。比如说配置rspec以排除文件夹,除非明确指定rspec运行该文件夹,rspec,configuration,rspec3,Rspec,Configuration,Rspec3,我想从rspec测试中排除文件夹,除非它被显式地作为命令行参数提供以运行。比如说 RSpec.configure do |config| unless rspec_args.any? { |arg| =~ /shared/ } # do not explicitly run shared folder config.exclude_pattern = 'shared/**/*_spec.rb' end end 我正在使用rspecv3.9 我有两个问题: 使用config
RSpec.configure do |config|
unless rspec_args.any? { |arg| =~ /shared/ } # do not explicitly run shared folder
config.exclude_pattern = 'shared/**/*_spec.rb'
end
end
我正在使用rspecv3.9
我有两个问题:
config.exclude\u pattern='shared/***\u spec.rb'
配置exlude\u pattern
似乎不会将共享文件夹从要运行的测试中排除。但是当我运行rspec--exclude pattern shared/***\u spec.rb
时,共享文件夹被从测试套件中排除我能够通过以下配置实现这一点:
# .rspec
--require spec_helper
# spec_helper.rb
RSpec.configure do |config|
config.exclude_pattern = 'shared/**/*_spec.rb'
end