describe 'Utils' do
puts 1111
describe '#time_condition' do
puts 2221
it do
puts 'aaa'
end
puts 2223
end
end
我的 launch.json 配置如下
{
"name": "RSpec - all",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/spec/*_rspec.rb",
"args": [
"--pattern",
"*_rspec.rb"
]
},
当我在VSCode上运行测试时,出现了以下错误提示:
1111
2221
2223
当我通过命令运行测试时,出现了以下错误:
>rspec spec --pattern *_rspec.rb
1111
2221
2223
aaa
.
Finished in 0.003 seconds (files took 0.23602 seconds to load)
1 example, 0 failures
如您所见,没有"aaa"的输出,意味着"it"没有被执行。
那么......我该如何在VS Code上运行"it"呢?
顺便说一下,我的spec配置文件(通过rspec --init生成)如下:
.rspec
--color
--require spec_helper
spec\spec_helper.rb
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.profile_examples = 10
config.order = :random
Kernel.srand config.seed
end
软件版本:VScode 1.4.0
Ruby扩展:0.5.3
谢谢
it '测试名称' do
。 - Bustikiller