Skip to content

Commit

Permalink
Updated to Berkshelf 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaugher committed Nov 24, 2015
1 parent d802fc1 commit 9655fc3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ test/tmp
test/version_tmp
tmp
chef-berksfile-env*.gem
vendor/
2 changes: 1 addition & 1 deletion chef-berksfile-env.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "berkshelf", "~> 3.0"
spec.add_dependency "berkshelf", "~> 4.0"
spec.add_dependency "chef", ">= 11.0", "< 13.0"

spec.add_development_dependency "bundler", "~> 1.6"
Expand Down
16 changes: 10 additions & 6 deletions spec/chef-berksfile-env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

describe Chef::Environment do

before(:all) do
berks_install
end

describe "#load_berksfile" do

let(:env) do
env = Chef::Environment.new

Expand Down Expand Up @@ -40,7 +44,7 @@
describe "while executing in root dir of relative path" do
it "should add the Berksfile dependencies" do
test_env = Chef::Environment.new
test_env.load_berksfile "chef-berksfile-env/spec/resources/environments/test_env/Berksfile"
test_env.load_berksfile berksfile_path

expect(test_env.cookbook_versions).to eq env.cookbook_versions
end
Expand All @@ -50,7 +54,7 @@
it "should add the Berksfile dependencies" do
Dir.chdir "spec/resources" do
test_env = Chef::Environment.new
test_env.load_berksfile "chef-berksfile-env/spec/resources/environments/test_env/Berksfile"
test_env.load_berksfile berksfile_path

expect(test_env.cookbook_versions).to eq env.cookbook_versions
end
Expand All @@ -60,8 +64,8 @@
describe "whose Berksfile does not exist" do
it "should raise an error" do
test_env = Chef::Environment.new
expect { test_env.load_berksfile "Berksfile" }.to raise_error
expect { test_env.load_berksfile "Berksfile" }.to raise_error RuntimeError

end
end

Expand All @@ -78,4 +82,4 @@

end

end
end
4 changes: 2 additions & 2 deletions spec/resources/environments/test_env/Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://supermarket.getchef.com"
source "https://supermarket.chef.io"

cookbook "apache_zookeeper"
cookbook "apache_zookeeper"
10 changes: 9 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ def test_env_path
File.expand_path(File.join(File.dirname(__FILE__), "resources/environments/test_env.rb"))
end

end
def berksfile_path
'chef-berksfile-env/spec/resources/environments/test_env/Berksfile'
end

def berks_install
Berkshelf::Berksfile.from_file('spec/resources/environments/test_env/Berksfile').install
end

end

0 comments on commit 9655fc3

Please sign in to comment.