--warnings
选项(启用警告运行)
使用 --warnings
选项启用警告运行规范。
给定一个名为“example_spec.rb”的文件,其中包含
RSpec.describe do
it 'generates warning' do
$undefined
end
end
当我运行 rspec --warnings example_spec.rb
则输出应包含“warning”。
给定一个名为“example_spec.rb”的文件,其中包含
def foo(**kwargs)
kwargs
end
RSpec.describe do
it "should warn about keyword arguments with 'rspec -w'" do
expect(foo({a: 1})).to eq({a: 1})
end
end
当我运行 rspec -w example_spec.rb
则输出应包含“warning”。
给定一个名为“example_spec.rb”的文件,其中包含
RSpec.describe do
it 'generates warning' do
$undefined
end
end
当我运行 rspec example_spec.rb
则输出不应包含“warning”。