在我的说明书目录中运行 rspec 时输出错误。
C:\Users\a540409\IdeaProjects\stores-v2\chef>bundle exec rspec
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.99.0/lib/rspec/matchers/built_in/raise_error.rb:5:in `<class:RaiseError>': uninitialized constant RSpec::Matchers::BuiltIn::Rais
eError::MatchAliases (NameError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.99.0/lib/rspec/matchers/built_in/raise_error.rb:4:in `<module:BuiltIn>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.99.0/lib/rspec/matchers/built_in/raise_error.rb:3:in `<module:Matchers>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.99.0/lib/rspec/matchers/built_in/raise_error.rb:2:in `<module:RSpec>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.99.0/lib/rspec/matchers/built_in/raise_error.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chefspec-3.4.0/lib/chefspec/expect_exception.rb:1:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chefspec-3.4.0/lib/chefspec/expect_exception.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chefspec-3.4.0/lib/chefspec.rb:26:in `require_relative'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/chefspec-3.4.0/lib/chefspec.rb:26:in `<top (required)>'
from C:/Users/a540409/IdeaProjects/stores-v2/chef/spec/default_spec.rb:1:in `require'
from C:/Users/a540409/IdeaProjects/stores-v2/chef/spec/default_spec.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/configuration.rb:1065:in `load'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/configuration.rb:1065:in `block in load_spec_files'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/configuration.rb:1065:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/configuration.rb:1065:in `load_spec_files'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/command_line.rb:18:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/runner.rb:89:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.99.0/lib/rspec/core/runner.rb:17:in `block in autorun'
我尝试基于此使用 require 'rspec/expectations'但这没有帮助。尝试使用 chefdk for windows 运行。但是同样的问题
这是我的宝石清单。C:\Users\a540409\IdeaProjects\stores-v2\chef>gem 列表
*** LOCAL GEMS ***
activesupport (3.2.18)
addressable (2.3.6)
akami (1.2.2)
archive-tar-minitar (0.5.2)
berkshelf (3.1.3, 3.0.1, 2.0.17)
berkshelf-api-client (1.2.0)
bigdecimal (1.1.0)
buff-config (1.0.0, 0.4.0)
buff-extensions (1.0.0, 0.5.0)
buff-ignore (1.1.1)
buff-ruby_engine (0.1.0)
buff-shell_out (0.1.1)
builder (3.2.2)
bundler (1.6.3)
celluloid (0.16.0.pre, 0.15.2)
celluloid-io (0.16.0.pre, 0.15.0)
chef (11.12.0 x86-mingw32, 11.6.0)
chef-zero (2.2, 2.1.5, 2.0.2)
chefspec (4.0.0, 3.4.0)
chozo (0.6.1)
coderay (1.1.0)
columnize (0.8.9)
dep-selector-libgecode (1.0.1)
dep_selector (1.0.3)
diff-lcs (1.2.5)
em-winrm (0.5.5)
erubis (2.7.0)
eventmachine (1.0.3 x86-mingw32)
excon (0.37.0)
faraday (0.9.0, 0.8.9)
fauxhai (2.1.2)
ffi (1.9.3 x86-mingw32, 1.9.0 x86-mingw32, 1.5.0 x86-mingw32)
fog (1.22.1)
fog-brightbox (0.0.2)
fog-core (1.22.0)
fog-json (1.0.0)
foodcritic (4.0.0)
formatador (0.2.5)
gherkin (2.12.2 x86-mingw32)
gssapi (1.0.3)
gyoku (1.1.1)
hashie (3.0.0, 2.1.2)
highline (1.6.21)
hitimes (1.2.1)
httpclient (2.4.0)
httpi (0.9.7)
i18n (0.6.9)
io-console (0.3)
ipaddress (0.8.0)
json (1.8.1, 1.7.7, 1.5.5)
kitchen-vagrant (0.15.0)
knife-openstack (0.10.0)
knife-windows (0.6.0)
linecache19 (0.5.12)
little-plugger (1.1.3)
logging (1.8.2)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.0)
minitar (0.5.4)
minitest (2.5.1)
mixlib-authentication (1.3.0)
mixlib-cli (1.5.0, 1.3.0)
mixlib-config (2.1.0)
mixlib-log (1.6.0)
mixlib-shellout (1.4.0 x86-mingw32, 1.2.0 x86-mingw32)
multi_json (1.10.1)
multipart-post (2.0.0, 1.2.0)
net-http-persistent (2.9.4)
net-scp (1.2.1)
net-ssh (2.9.1)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0, 1.1)
nio4r (1.0.0)
nokogiri (1.6.2.1 x86-mingw32)
nori (1.1.5)
octokit (3.1.2, 2.7.2)
ohai (7.0.4)
polyglot (0.3.5)
pry (0.10.0 i386-mingw32)
rack (1.5.2)
rake (10.3.2, 0.9.2.2)
rbzip2 (0.2.0)
rdoc (3.9.5)
rdp-ruby-wmi (0.3.1)
rest-client (1.6.7)
retryable (1.3.5)
ridley (4.0.0, 3.1.0, 1.7.1)
rspec (3.0.0, 2.99.0)
rspec-core (3.0.2, 3.0.1, 2.99.0)
rspec-expectations (3.0.2, 3.0.1, 2.99.0)
rspec-its (1.0.1)
rspec-mocks (3.0.2, 3.0.1, 2.99.1)
rspec-support (3.0.2, 3.0.0, 3.0.0.rc1)
ruby-debug-base19x (0.11.30.pre3)
ruby-debug-ide (0.4.17)
ruby-wmi (0.4.0)
ruby_core_source (0.1.5)
rubyntlm (0.1.1)
rufus-lru (1.0.5)
safe_yaml (1.0.3, 0.9.7)
savon (0.9.5)
sawyer (0.5.4)
semverse (1.1.0)
slop (3.5.0)
solve (1.2.0, 0.8.2)
systemu (2.5.2)
test-kitchen (1.2.1, 1.1.0)
thor (0.19.1, 0.18.1)
timers (3.0.0, 2.0.0, 1.1.0)
treetop (1.5.3)
uuidtools (2.1.4)
varia_model (0.4.0, 0.3.2)
wasabi (1.0.0)
win32-api (1.5.1 universal-mingw32, 1.4.8 x86-mingw32)
win32-dir (0.4.5)
win32-event (0.6.1)
win32-ipc (0.6.1)
win32-mmap (0.4.0)
win32-mutex (0.4.1)
win32-process (0.7.4, 0.7.3)
win32-service (0.8.4, 0.8.2)
win32console (1.3.2 x86-mingw32)
windows-api (0.4.2)
windows-pr (1.2.3, 1.2.2)
winrm (1.1.3)
yajl-ruby (1.2.1)
我的 spec_helper.rb:
require 'rspec/expectations'
require 'chefspec'
require 'chefspec/berkshelf'
RSpec.configure do |config|
config.platform = 'redhat'
config.version = '6.3'
#config.log_level = :debug
end
我的 default_spec.rb:
require 'rspec/expectations'
require 'chefspec'
describe 'api-stores-v2::default' do
let (:chef_run) { ChefSpec::Runner.new.converge 'api-stores-v2::default' }
it 'installs dependent packages' do
expect(chef_run).to include_recipe('java')
end
end