Last active
December 20, 2015 04:59
-
-
Save maraca/6075307 to your computer and use it in GitHub Desktop.
ChefSpec cannot load such file -- rvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadError | |
--------- | |
cannot load such file -- rvm | |
Cookbook Trace: | |
--------------- | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb:25:in `require' | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file' | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file' | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file' | |
/home/martin/application-cookbook/vendor/cookbooks/application/recipes/app.rb:2:in `from_file' | |
/home/martin/application-cookbook/spec/app_spec.rb:14:in `block (2 levels) in <top (required)>' | |
/home/martin/application-cookbook/spec/app_spec.rb:22:in `block (2 levels) in <top (required)>' | |
Relevant File Content: | |
---------------------- | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb: | |
18: # | |
19: | |
20: # install rvm api gem during chef compile phase | |
21: chef_gem 'rvm' do | |
22: action :install | |
23: version '>= 1.11.3.6' | |
24: end | |
25>> require 'rvm' | |
26: | |
27: create_rvm_shell_chef_wrapper | |
28: create_rvm_chef_user_environment | |
29: | |
30: class Chef::Resource | |
31: # mix in #rvm_cmd_wrap helper into resources | |
32: include Chef::RVM::ShellHelpers | |
33: end | |
34: | |
F | |
Failures: | |
1) application::app includes the chef-rvm system-wide recipe | |
Failure/Error: runner.converge 'application::app' | |
LoadError: | |
cannot load such file -- rvm | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `require' | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file' | |
# ./vendor/cookbooks/application/recipes/app.rb:2:in `from_file' | |
# ./spec/app_spec.rb:14:in `block (2 levels) in <top (required)>' | |
# ./spec/app_spec.rb:18:in `block (2 levels) in <top (required)>' | |
2) application::app creates a /app/prod/ directory | |
Failure/Error: runner.converge 'application::app' | |
LoadError: | |
cannot load such file -- rvm | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `require' | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file' | |
# ./vendor/cookbooks/application/recipes/app.rb:2:in `from_file' | |
# ./spec/app_spec.rb:14:in `block (2 levels) in <top (required)>' | |
# ./spec/app_spec.rb:22:in `block (2 levels) in <top (required)>' | |
Finished in 0.34893 seconds | |
2 examples, 2 failures | |
Failed examples: | |
rspec ./spec/app_spec.rb:17 # application::app includes the chef-rvm system-wide recipe | |
rspec ./spec/app_spec.rb:21 # application::app creates a /app/prod/ directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_recipe "rvm::system" | |
directory "app" do | |
owner node['proxy']['user'] | |
group node['proxy']['group'] | |
path node['app']['path'] | |
recursive true | |
action :create | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require "chefspec" | |
describe 'application::app' do | |
let(:app_path) { '/app/prod' } | |
let(:cpu) { 1 } | |
let(:chef_run) { | |
runner = ChefSpec::ChefRunner.new(:platform => 'ubuntu', :version => '12.04') | |
runner.node.set['cpu']['total'] = cpu | |
runner.node.set['app']['path'] = app_path | |
runner.converge 'application::app' | |
} | |
it 'includes the chef-rvm system-wide recipe' do | |
expect(chef_run).to include_recipe 'rvm::system' | |
end | |
it 'creates a /app/prod/ directory' do | |
expect(chef_run).to create_directory app_path | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've encountered the same problem in a different way:
This fails: