From af88d117d6486e7e10b86ea6499c3c35cf015938 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Sat, 1 Nov 2014 10:42:42 -0400 Subject: [PATCH] Do not read Berkshelf config values in cookbook generator spec Fixes #1226 --- .../unit/berkshelf/cookbook_generator_spec.rb | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/spec/unit/berkshelf/cookbook_generator_spec.rb b/spec/unit/berkshelf/cookbook_generator_spec.rb index 126ed167b..2582c1ce9 100644 --- a/spec/unit/berkshelf/cookbook_generator_spec.rb +++ b/spec/unit/berkshelf/cookbook_generator_spec.rb @@ -1,17 +1,30 @@ require 'spec_helper' describe Berkshelf::CookbookGenerator do - let(:name) { 'sparkle_motion' } + let(:name) { 'sparkle_motion' } + let(:license) { 'reserved' } + let(:maintainer) { 'Berkshelf Core' } + let(:maintainer_email) { 'core@berkshelf.com' } + let(:target) { tmp_path.join(name) } let(:kitchen_generator) { double('kitchen-generator', invoke_all: nil) } before do - allow(Kitchen::Generator::Init).to receive(:new).with(any_args()).and_return(kitchen_generator) + allow(Kitchen::Generator::Init) + .to receive(:new) + .with(any_args()) + .and_return(kitchen_generator) end context 'with default options' do before do - capture(:stdout) { Berkshelf::CookbookGenerator.new([target, name]).invoke_all } + capture(:stdout) do + Berkshelf::CookbookGenerator.new([target, name], + license: license, + maintainer: maintainer, + maintainer_email: maintainer_email, + ).invoke_all + end end it "generates a new cookbook" do @@ -26,7 +39,7 @@ file 'default.rb' do contains '# Cookbook Name:: sparkle_motion' contains '# Recipe:: default' - contains "# Copyright (C) #{Time.now.year} YOUR_NAME" + contains "# Copyright (C) #{Time.now.year} Berkshelf Core" contains '# All rights reserved - Do Not Redistribute' end end @@ -35,7 +48,7 @@ directory 'default' end file 'LICENSE' do - contains "Copyright (C) #{Time.now.year} YOUR_NAME" + contains "Copyright (C) #{Time.now.year} Berkshelf Core" contains 'All rights reserved - Do Not Redistribute' end file 'README.md' do @@ -44,7 +57,7 @@ contains " ['sparkle_motion']['bacon']" contains "Include `sparkle_motion` in your node's `run_list`:" contains ' "recipe[sparkle_motion::default]"' - contains 'Author:: YOUR_NAME ()' + contains 'Author:: Berkshelf Core ()' end file 'CHANGELOG.md' do contains '# 0.1.0' @@ -52,8 +65,8 @@ end file 'metadata.rb' do contains "name 'sparkle_motion'" - contains "maintainer 'YOUR_NAME'" - contains "maintainer_email 'YOUR_EMAIL'" + contains "maintainer 'Berkshelf Core'" + contains "maintainer_email 'core@berkshelf.com'" contains "license 'All rights reserved'" contains "description 'Installs/Configures sparkle_motion'" end