我正在使用 Test-Kitchen 和 Serverspec 进行集成测试。我想使用 Serverspec 文件资源来验证是否存在隐藏文件,在这种情况下是.gemrc
. 这是我的规格配置:
require 'spec_helper'
describe "Checking the .gemrc" do
describe file('~/.gemrc') do
it { should be_file }
end
end
这是错误输出:
Check .gemrc
File "~/.gemrc"
should be file (FAILED - 1)
Failures:
1) Check .gemrc File "~/.gemrc" should be file
Failure/Error: it { should be_file }
test -f \~/.gemrc
expected file? to return true, got false
# /tmp/busser/suites/serverspec/default/ruby_spec.rb:14:in `block (3 levels) in <top (required)>'
Finished in 0.06349 seconds
1 example, 1 failure
为什么file
资源没有将 .gemrc 文件视为普通文件?