0

ChefSpec で実行される HelloWorld タイプの例を取得しようとしています。実行$ chef generate cookbook learn_chef2して、適切なディレクトリ構造を持つ Chef クックブックを生成しました。

次に、default.rb に非常にシンプルな Chef レシピを作成しました。

package 'ant'
package 'php5'
package 'git'

そして、default_spec.rb での私の ChefSpec テスト:

#require 'spec_helper'
require 'chefspec'
require 'chefspec/berkshelf'

describe 'package::install' do

  let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }

  it 'converges successfully' do
    expect(chef_run).to install_package('ant')
  end
end

ただし、rspec を実行すると、次のようになります。

/var/lib/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/formatters/progress_formatter.rb:1:in `<top (required)>': undefined method `require_rspec_core' for RSpec::Support:Module (NoMethodError)
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:1093:in `built_in_formatter'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:573:in `add_formatter'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:589:in `reporter'
    from /usr/lib/ruby/vendor_ruby/rspec/core/command_line.rb:25:in `run'
    from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:80:in `run'
    from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:17:in `block in autorun'

私はRubyとRSpecが初めてで、単純な構成の問題だと確信しています。何かご意見は?

ありがとう!

4

1 に答える 1