summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /spec/integration
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/client/client_spec.rb124
-rw-r--r--spec/integration/client/ipv6_spec.rb18
-rw-r--r--spec/integration/knife/chef_fs_data_store_spec.rb298
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb496
-rw-r--r--spec/integration/knife/chef_repository_file_system_spec.rb164
-rw-r--r--spec/integration/knife/chefignore_spec.rb160
-rw-r--r--spec/integration/knife/common_options_spec.rb78
-rw-r--r--spec/integration/knife/cookbook_api_ipv6_spec.rb8
-rw-r--r--spec/integration/knife/delete_spec.rb512
-rw-r--r--spec/integration/knife/deps_spec.rb556
-rw-r--r--spec/integration/knife/diff_spec.rb466
-rw-r--r--spec/integration/knife/download_spec.rb876
-rw-r--r--spec/integration/knife/list_spec.rb266
-rw-r--r--spec/integration/knife/raw_spec.rb74
-rw-r--r--spec/integration/knife/redirection_spec.rb20
-rw-r--r--spec/integration/knife/serve_spec.rb20
-rw-r--r--spec/integration/knife/show_spec.rb114
-rw-r--r--spec/integration/knife/upload_spec.rb1180
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb36
-rw-r--r--spec/integration/recipes/lwrp_spec.rb14
-rw-r--r--spec/integration/recipes/provider_choice.rb4
-rw-r--r--spec/integration/recipes/recipe_dsl_spec.rb244
-rw-r--r--spec/integration/recipes/remote_directory.rb4
-rw-r--r--spec/integration/recipes/resource_action_spec.rb100
-rw-r--r--spec/integration/recipes/resource_converge_if_changed_spec.rb22
-rw-r--r--spec/integration/recipes/resource_load_spec.rb48
-rw-r--r--spec/integration/solo/solo_spec.rb56
27 files changed, 2979 insertions, 2979 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 5e72a94065..0ca784d468 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -1,13 +1,13 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
-require 'tiny_server'
-require 'tmpdir'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
+require "tiny_server"
+require "tmpdir"
describe "chef-client" do
def recipes_filename
- File.join(CHEF_SPEC_DATA, 'recipes.tgz')
+ File.join(CHEF_SPEC_DATA, "recipes.tgz")
end
def start_tiny_server(server_opts={})
@@ -48,13 +48,13 @@ describe "chef-client" do
# cf. CHEF-4914
let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
- let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(' ') }
+ let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(" ") }
when_the_repository "has a cookbook with a no-op recipe" do
- before { file 'cookbooks/x/recipes/default.rb', '' }
+ before { file "cookbooks/x/recipes/default.rb", "" }
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -63,7 +63,7 @@ EOM
end
it "should complete successfully with no other environment variables", :skip => (Chef::Platform.windows?) do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -79,7 +79,7 @@ EOM
end
it "should complete successfully with --no-listen" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -90,32 +90,32 @@ EOM
it "should be able to node.save with bad utf8 characters in the node data" do
file "cookbooks/x/attributes/default.rb", 'default["badutf8"] = "Elan Ruusam\xE4e"'
- result = shell_out("#{chef_client} -z -r 'x::default' --disable-config", :cwd => path_to(''))
+ result = shell_out("#{chef_client} -z -r 'x::default' --disable-config", :cwd => path_to(""))
result.error!
end
- context 'and no config file' do
- it 'should complete with success when cwd is just above cookbooks and paths are not specified' do
- result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to(''))
+ context "and no config file" do
+ it "should complete with success when cwd is just above cookbooks and paths are not specified" do
+ result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to(""))
result.error!
end
- it 'should complete with success when cwd is below cookbooks and paths are not specified' do
- result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to('cookbooks/x'))
+ it "should complete with success when cwd is below cookbooks and paths are not specified" do
+ result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to("cookbooks/x"))
result.error!
end
- it 'should fail when cwd is below high above and paths are not specified' do
- result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => File.expand_path('..', path_to('')))
+ it "should fail when cwd is below high above and paths are not specified" do
+ result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => File.expand_path("..", path_to("")))
expect(result.exitstatus).to eq(1)
end
end
- context 'and a config file under .chef/knife.rb' do
- before { file '.chef/knife.rb', 'xxx.xxx' }
+ context "and a config file under .chef/knife.rb" do
+ before { file ".chef/knife.rb", "xxx.xxx" }
- it 'should load .chef/knife.rb when -z is specified' do
- result = shell_out("#{chef_client} -z -o 'x::default'", :cwd => path_to(''))
+ it "should load .chef/knife.rb when -z is specified" do
+ result = shell_out("#{chef_client} -z -o 'x::default'", :cwd => path_to(""))
# FATAL: Configuration error NoMethodError: undefined method `xxx' for nil:NilClass
expect(result.stdout).to include("xxx")
end
@@ -123,7 +123,7 @@ EOM
end
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -132,9 +132,9 @@ EOM
result.error!
end
- context 'and a private key' do
+ context "and a private key" do
before do
- file 'mykey.pem', <<EOM
+ file "mykey.pem", <<EOM
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf
0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk
@@ -166,7 +166,7 @@ EOM
end
it "should complete with success even with a client key" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
@@ -177,19 +177,19 @@ EOM
end
it "should run recipes specified directly on the command line" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- file 'arbitrary.rb', <<EOM
+ file "arbitrary.rb", <<EOM
file #{path_to('tempfile.txt').inspect} do
content '1'
end
EOM
- file 'arbitrary2.rb', <<EOM
+ file "arbitrary2.rb", <<EOM
file #{path_to('tempfile2.txt').inspect} do
content '2'
end
@@ -198,57 +198,57 @@ EOM
result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", :cwd => chef_dir)
result.error!
- expect(IO.read(path_to('tempfile.txt'))).to eq('1')
- expect(IO.read(path_to('tempfile2.txt'))).to eq('2')
+ expect(IO.read(path_to("tempfile.txt"))).to eq("1")
+ expect(IO.read(path_to("tempfile2.txt"))).to eq("2")
end
it "should run recipes specified as relative paths directly on the command line" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- file 'arbitrary.rb', <<EOM
+ file "arbitrary.rb", <<EOM
file #{path_to('tempfile.txt').inspect} do
content '1'
end
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", :cwd => path_to(''))
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", :cwd => path_to(""))
result.error!
- expect(IO.read(path_to('tempfile.txt'))).to eq('1')
+ expect(IO.read(path_to("tempfile.txt"))).to eq("1")
end
it "should run recipes specified directly on the command line AFTER recipes in the run list" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- file 'cookbooks/x/recipes/constant_definition.rb', <<EOM
+ file "cookbooks/x/recipes/constant_definition.rb", <<EOM
class ::Blah
THECONSTANT = '1'
end
EOM
- file 'arbitrary.rb', <<EOM
+ file "arbitrary.rb", <<EOM
file #{path_to('tempfile.txt').inspect} do
content ::Blah::THECONSTANT
end
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", :cwd => path_to(''))
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", :cwd => path_to(""))
result.error!
- expect(IO.read(path_to('tempfile.txt'))).to eq('1')
+ expect(IO.read(path_to("tempfile.txt"))).to eq("1")
end
end
it "should complete with success when passed the -z flag" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -258,7 +258,7 @@ EOM
end
it "should complete with success when passed the --local-mode flag" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -268,7 +268,7 @@ EOM
end
it "should not print SSL warnings when running in local-mode" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -279,7 +279,7 @@ EOM
end
it "should complete with success when passed -z and --chef-zero-port" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -289,7 +289,7 @@ EOM
end
it "should complete with success when setting the run list with -r" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -302,7 +302,7 @@ EOM
end
it "should complete with success when using --profile-ruby and output a profile file" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -311,7 +311,7 @@ EOM
end
it "doesn't produce a profile when --profile-ruby is not present" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -322,13 +322,13 @@ EOM
when_the_repository "has a cookbook that should fail chef_version checks" do
before do
- file 'cookbooks/x/recipes/default.rb', ''
- file 'cookbooks/x/metadata.rb', <<EOM
+ file "cookbooks/x/recipes/default.rb", ""
+ file "cookbooks/x/metadata.rb", <<EOM
name 'x'
version '0.0.1'
chef_version '~> 999.99'
EOM
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -342,7 +342,7 @@ EOM
when_the_repository "has a cookbook that uses cheffish resources" do
before do
- file 'cookbooks/x/recipes/default.rb', <<-EOM
+ file "cookbooks/x/recipes/default.rb", <<-EOM
raise "Cheffish was loaded before we used any cheffish things!" if defined?(Cheffish::VERSION)
ran_block = false
got_server = with_chef_server 'https://blah.com' do
@@ -353,7 +353,7 @@ EOM
raise "Cheffish was not loaded when we did cheffish things!" if !defined?(Cheffish::VERSION)
raise "current_chef_server did not return its value!" if got_server[:chef_server_url] != 'https://blah.com'
EOM
- file 'config/client.rb', <<-EOM
+ file "config/client.rb", <<-EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -367,10 +367,10 @@ EOM
when_the_repository "has a cookbook that uses chef-provisioning resources" do
before do
- file 'cookbooks/x/recipes/default.rb', <<-EOM
+ file "cookbooks/x/recipes/default.rb", <<-EOM
with_driver 'blah'
EOM
- file 'config/client.rb', <<-EOM
+ file "config/client.rb", <<-EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -385,7 +385,7 @@ EOM
when_the_repository "has a cookbook that generates deprecation warnings" do
before do
- file 'cookbooks/x/recipes/default.rb', <<-EOM
+ file "cookbooks/x/recipes/default.rb", <<-EOM
class ::MyResource < Chef::Resource
use_automatic_resource_name
property :x, default: []
@@ -412,7 +412,7 @@ EOM
end
it "should output each deprecation warning only once, at the end of the run" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
# Mimick what happens when you are on the console
@@ -420,7 +420,7 @@ formatters << :doc
log_level :warn
EOM
- ENV.delete('CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS')
+ ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS")
result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
expect(result.error?).to be_falsey
@@ -437,7 +437,7 @@ EOM
when_the_repository "has a cookbook with only an audit recipe" do
before do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
audit_mode :enabled
@@ -445,7 +445,7 @@ EOM
end
it "should exit with a zero code when there is not an audit failure" do
- file 'cookbooks/audit_test/recipes/succeed.rb', <<-RECIPE
+ file "cookbooks/audit_test/recipes/succeed.rb", <<-RECIPE
control_group "control group without top level control" do
it "should succeed" do
expect(2 - 2).to eq(0)
@@ -459,7 +459,7 @@ end
end
it "should exit with a non-zero code when there is an audit failure" do
- file 'cookbooks/audit_test/recipes/fail.rb', <<-RECIPE
+ file "cookbooks/audit_test/recipes/fail.rb", <<-RECIPE
control_group "control group without top level control" do
it "should fail" do
expect(2 - 2).to eq(1)
@@ -486,14 +486,14 @@ end
let(:tmp_dir) { Dir.mktmpdir("recipe-url") }
it "should complete with success when passed -z and --recipe-url" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_repo_path "#{tmp_dir}"
EOM
result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", :cwd => tmp_dir)
result.error!
end
- it 'should fail when passed --recipe-url and not passed -z' do
+ it "should fail when passed --recipe-url and not passed -z" do
result = shell_out("#{chef_client} --recipe-url=http://localhost:9000/recipes.tgz", :cwd => tmp_dir)
expect(result.exitstatus).not_to eq(0)
end
diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb
index 493ad79e7c..e8e8753731 100644
--- a/spec/integration/client/ipv6_spec.rb
+++ b/spec/integration/client/ipv6_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "chef-client" do
include IntegrationSupport
@@ -88,9 +88,9 @@ END_CLIENT_RB
when_the_repository "has a cookbook with a no-op recipe" do
before do
- cookbook 'noop', '1.0.0', { }, "recipes" => {"default.rb" => "#raise 'foo'"}
- file 'config/client.rb', client_rb_content
- file 'config/validator.pem', validation_pem
+ cookbook "noop", "1.0.0", { }, "recipes" => {"default.rb" => "#raise 'foo'"}
+ file "config/client.rb", client_rb_content
+ file "config/validator.pem", validation_pem
end
it "should complete with success" do
@@ -115,14 +115,14 @@ END_CLIENT_RB
END_RECIPE
- data_bag('expect_bag', { 'expect_item' => {"expect_key" => "expect_value"} })
+ data_bag("expect_bag", { "expect_item" => {"expect_key" => "expect_value"} })
- cookbook 'api-smoke-test', '1.0.0', { }, "recipes" => {"default.rb" => recipe}
+ cookbook "api-smoke-test", "1.0.0", { }, "recipes" => {"default.rb" => recipe}
end
before do
- file 'config/client.rb', client_rb_content
- file 'config/validator.pem', validation_pem
+ file "config/client.rb", client_rb_content
+ file "config/validator.pem", validation_pem
end
it "should complete with success" do
diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb
index c1f2c7134f..b4f2d4ca71 100644
--- a/spec/integration/knife/chef_fs_data_store_spec.rb
+++ b/spec/integration/knife/chef_fs_data_store_spec.rb
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/list'
-require 'chef/knife/delete'
-require 'chef/knife/show'
-require 'chef/knife/raw'
-require 'chef/knife/cookbook_upload'
-
-describe 'ChefFSDataStore tests', :workstation do
+require "support/shared/integration/integration_helper"
+require "chef/knife/list"
+require "chef/knife/delete"
+require "chef/knife/show"
+require "chef/knife/raw"
+require "chef/knife/cookbook_upload"
+
+describe "ChefFSDataStore tests", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -31,18 +31,18 @@ describe 'ChefFSDataStore tests', :workstation do
when_the_repository "has one of each thing" do
before do
- file 'clients/x.json', {}
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'data_bags/x/y.json', {}
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/x.json', {}
+ file "clients/x.json", {}
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "data_bags/x/y.json", {}
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/x.json", {}
end
- context 'GET /TYPE' do
- it 'knife list -z -R returns everything' do
- knife('list -z -Rfp /').should_succeed <<EOM
+ context "GET /TYPE" do
+ it "knife list -z -R returns everything" do
+ knife("list -z -Rfp /").should_succeed <<EOM
/clients/
/clients/x.json
/cookbooks/
@@ -63,128 +63,128 @@ EOM
end
end
- context 'DELETE /TYPE/NAME' do
- it 'knife delete -z /clients/x.json works' do
- knife('delete -z /clients/x.json').should_succeed "Deleted /clients/x.json\n"
- knife('list -z -Rfp /clients').should_succeed ''
+ context "DELETE /TYPE/NAME" do
+ it "knife delete -z /clients/x.json works" do
+ knife("delete -z /clients/x.json").should_succeed "Deleted /clients/x.json\n"
+ knife("list -z -Rfp /clients").should_succeed ""
end
- it 'knife delete -z -r /cookbooks/x works' do
- knife('delete -z -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -z -Rfp /cookbooks').should_succeed ''
+ it "knife delete -z -r /cookbooks/x works" do
+ knife("delete -z -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -z -Rfp /cookbooks").should_succeed ""
end
- it 'knife delete -z -r /data_bags/x works' do
- knife('delete -z -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -z -Rfp /data_bags').should_succeed ''
+ it "knife delete -z -r /data_bags/x works" do
+ knife("delete -z -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -z -Rfp /data_bags").should_succeed ""
end
- it 'knife delete -z /data_bags/x/y.json works' do
- knife('delete -z /data_bags/x/y.json').should_succeed "Deleted /data_bags/x/y.json\n"
- knife('list -z -Rfp /data_bags').should_succeed "/data_bags/x/\n"
+ it "knife delete -z /data_bags/x/y.json works" do
+ knife("delete -z /data_bags/x/y.json").should_succeed "Deleted /data_bags/x/y.json\n"
+ knife("list -z -Rfp /data_bags").should_succeed "/data_bags/x/\n"
end
- it 'knife delete -z /environments/x.json works' do
- knife('delete -z /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -z -Rfp /environments').should_succeed ''
+ it "knife delete -z /environments/x.json works" do
+ knife("delete -z /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -z -Rfp /environments").should_succeed ""
end
- it 'knife delete -z /nodes/x.json works' do
- knife('delete -z /nodes/x.json').should_succeed "Deleted /nodes/x.json\n"
- knife('list -z -Rfp /nodes').should_succeed ''
+ it "knife delete -z /nodes/x.json works" do
+ knife("delete -z /nodes/x.json").should_succeed "Deleted /nodes/x.json\n"
+ knife("list -z -Rfp /nodes").should_succeed ""
end
- it 'knife delete -z /roles/x.json works' do
- knife('delete -z /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -z -Rfp /roles').should_succeed ''
+ it "knife delete -z /roles/x.json works" do
+ knife("delete -z /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -z -Rfp /roles").should_succeed ""
end
- it 'knife delete -z /users/x.json works' do
- knife('delete -z /users/x.json').should_succeed "Deleted /users/x.json\n"
- knife('list -z -Rfp /users').should_succeed ''
+ it "knife delete -z /users/x.json works" do
+ knife("delete -z /users/x.json").should_succeed "Deleted /users/x.json\n"
+ knife("list -z -Rfp /users").should_succeed ""
end
end
- context 'GET /TYPE/NAME' do
- it 'knife show -z /clients/x.json works' do
- knife('show -z /clients/x.json').should_succeed( /"x"/ )
+ context "GET /TYPE/NAME" do
+ it "knife show -z /clients/x.json works" do
+ knife("show -z /clients/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /cookbooks/x/metadata.rb works' do
- knife('show -z /cookbooks/x/metadata.rb').should_succeed "/cookbooks/x/metadata.rb:\n#{cookbook_x_100_metadata_rb}\n"
+ it "knife show -z /cookbooks/x/metadata.rb works" do
+ knife("show -z /cookbooks/x/metadata.rb").should_succeed "/cookbooks/x/metadata.rb:\n#{cookbook_x_100_metadata_rb}\n"
end
- it 'knife show -z /data_bags/x/y.json works' do
- knife('show -z /data_bags/x/y.json').should_succeed( /"y"/ )
+ it "knife show -z /data_bags/x/y.json works" do
+ knife("show -z /data_bags/x/y.json").should_succeed( /"y"/ )
end
- it 'knife show -z /environments/x.json works' do
- knife('show -z /environments/x.json').should_succeed( /"x"/ )
+ it "knife show -z /environments/x.json works" do
+ knife("show -z /environments/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /nodes/x.json works' do
- knife('show -z /nodes/x.json').should_succeed( /"x"/ )
+ it "knife show -z /nodes/x.json works" do
+ knife("show -z /nodes/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /roles/x.json works' do
- knife('show -z /roles/x.json').should_succeed( /"x"/ )
+ it "knife show -z /roles/x.json works" do
+ knife("show -z /roles/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /users/x.json works' do
- knife('show -z /users/x.json').should_succeed( /"x"/ )
+ it "knife show -z /users/x.json works" do
+ knife("show -z /users/x.json").should_succeed( /"x"/ )
end
end
- context 'PUT /TYPE/NAME' do
+ context "PUT /TYPE/NAME" do
before do
- file 'empty.json', {}
- file 'dummynode.json', { "name" => "x", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
- file 'rolestuff.json', '{"description":"hi there","name":"x"}'
- file 'cookbooks_to_upload/x/metadata.rb', cookbook_x_100_metadata_rb
+ file "empty.json", {}
+ file "dummynode.json", { "name" => "x", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
+ file "rolestuff.json", '{"description":"hi there","name":"x"}'
+ file "cookbooks_to_upload/x/metadata.rb", cookbook_x_100_metadata_rb
end
- it 'knife raw -z -i empty.json -m PUT /clients/x' do
+ it "knife raw -z -i empty.json -m PUT /clients/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_succeed( /"x"/ )
- knife('list --local /clients').should_succeed "/clients/x.json\n"
+ knife("list --local /clients").should_succeed "/clients/x.json\n"
end
- it 'knife cookbook upload works' do
+ it "knife cookbook upload works" do
knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed :stderr => <<EOM
Uploading x [1.0.0]
Uploaded 1 cookbook.
EOM
- knife('list --local -Rfp /cookbooks').should_succeed "/cookbooks/x/\n/cookbooks/x/metadata.rb\n"
+ knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/x/\n/cookbooks/x/metadata.rb\n"
end
- it 'knife raw -z -i empty.json -m PUT /data/x/y' do
+ it "knife raw -z -i empty.json -m PUT /data/x/y" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_succeed( /"y"/ )
- knife('list --local -Rfp /data_bags').should_succeed "/data_bags/x/\n/data_bags/x/y.json\n"
+ knife("list --local -Rfp /data_bags").should_succeed "/data_bags/x/\n/data_bags/x/y.json\n"
end
- it 'knife raw -z -i empty.json -m PUT /environments/x' do
+ it "knife raw -z -i empty.json -m PUT /environments/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_succeed( /"x"/ )
- knife('list --local /environments').should_succeed "/environments/x.json\n"
+ knife("list --local /environments").should_succeed "/environments/x.json\n"
end
- it 'knife raw -z -i dummynode.json -m PUT /nodes/x' do
+ it "knife raw -z -i dummynode.json -m PUT /nodes/x" do
knife("raw -z -i #{path_to('dummynode.json')} -m PUT /nodes/x").should_succeed( /"x"/ )
- knife('list --local /nodes').should_succeed "/nodes/x.json\n"
- knife('show -z /nodes/x.json --verbose').should_succeed /"bar"/
+ knife("list --local /nodes").should_succeed "/nodes/x.json\n"
+ knife("show -z /nodes/x.json --verbose").should_succeed /"bar"/
end
- it 'knife raw -z -i empty.json -m PUT /roles/x' do
+ it "knife raw -z -i empty.json -m PUT /roles/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_succeed( /"x"/ )
- knife('list --local /roles').should_succeed "/roles/x.json\n"
+ knife("list --local /roles").should_succeed "/roles/x.json\n"
end
- it 'knife raw -z -i empty.json -m PUT /users/x' do
+ it "knife raw -z -i empty.json -m PUT /users/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_succeed( /"x"/ )
- knife('list --local /users').should_succeed "/users/x.json\n"
+ knife("list --local /users").should_succeed "/users/x.json\n"
end
- it 'After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty', :skip => (RUBY_VERSION < "1.9") do
+ it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", :skip => (RUBY_VERSION < "1.9") do
knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ )
- expect(IO.read(path_to('roles/x.json'))).to eq <<EOM.strip
+ expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
"name": "x",
"description": "hi there"
@@ -194,65 +194,65 @@ EOM
end
end
- when_the_repository 'is empty' do
- context 'POST /TYPE/NAME' do
+ when_the_repository "is empty" do
+ context "POST /TYPE/NAME" do
before do
- file 'empty.json', { 'name' => 'z' }
- file 'dummynode.json', { "name" => "z", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
- file 'empty_x.json', { 'name' => 'x' }
- file 'empty_id.json', { 'id' => 'z' }
- file 'rolestuff.json', '{"description":"hi there","name":"x"}'
- file 'cookbooks_to_upload/z/metadata.rb', cookbook_z_100_metadata_rb
+ file "empty.json", { "name" => "z" }
+ file "dummynode.json", { "name" => "z", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
+ file "empty_x.json", { "name" => "x" }
+ file "empty_id.json", { "id" => "z" }
+ file "rolestuff.json", '{"description":"hi there","name":"x"}'
+ file "cookbooks_to_upload/z/metadata.rb", cookbook_z_100_metadata_rb
end
- it 'knife raw -z -i empty.json -m POST /clients' do
+ it "knife raw -z -i empty.json -m POST /clients" do
knife("raw -z -i #{path_to('empty.json')} -m POST /clients").should_succeed( /uri/ )
- knife('list --local /clients').should_succeed "/clients/z.json\n"
+ knife("list --local /clients").should_succeed "/clients/z.json\n"
end
- it 'knife cookbook upload works' do
+ it "knife cookbook upload works" do
knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed :stderr => <<EOM
Uploading z [1.0.0]
Uploaded 1 cookbook.
EOM
- knife('list --local -Rfp /cookbooks').should_succeed "/cookbooks/z/\n/cookbooks/z/metadata.rb\n"
+ knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/z/\n/cookbooks/z/metadata.rb\n"
end
- it 'knife raw -z -i empty.json -m POST /data' do
+ it "knife raw -z -i empty.json -m POST /data" do
knife("raw -z -i #{path_to('empty.json')} -m POST /data").should_succeed( /uri/ )
- knife('list --local -Rfp /data_bags').should_succeed "/data_bags/z/\n"
+ knife("list --local -Rfp /data_bags").should_succeed "/data_bags/z/\n"
end
- it 'knife raw -z -i empty.json -m POST /data/x' do
+ it "knife raw -z -i empty.json -m POST /data/x" do
knife("raw -z -i #{path_to('empty_x.json')} -m POST /data").should_succeed( /uri/ )
knife("raw -z -i #{path_to('empty_id.json')} -m POST /data/x").should_succeed( /"z"/ )
- knife('list --local -Rfp /data_bags').should_succeed "/data_bags/x/\n/data_bags/x/z.json\n"
+ knife("list --local -Rfp /data_bags").should_succeed "/data_bags/x/\n/data_bags/x/z.json\n"
end
- it 'knife raw -z -i empty.json -m POST /environments' do
+ it "knife raw -z -i empty.json -m POST /environments" do
knife("raw -z -i #{path_to('empty.json')} -m POST /environments").should_succeed( /uri/ )
- knife('list --local /environments').should_succeed "/environments/z.json\n"
+ knife("list --local /environments").should_succeed "/environments/z.json\n"
end
- it 'knife raw -z -i dummynode.json -m POST /nodes' do
+ it "knife raw -z -i dummynode.json -m POST /nodes" do
knife("raw -z -i #{path_to('dummynode.json')} -m POST /nodes").should_succeed( /uri/ )
- knife('list --local /nodes').should_succeed "/nodes/z.json\n"
- knife('show -z /nodes/z.json').should_succeed /"bar"/
+ knife("list --local /nodes").should_succeed "/nodes/z.json\n"
+ knife("show -z /nodes/z.json").should_succeed /"bar"/
end
- it 'knife raw -z -i empty.json -m POST /roles' do
+ it "knife raw -z -i empty.json -m POST /roles" do
knife("raw -z -i #{path_to('empty.json')} -m POST /roles").should_succeed( /uri/ )
- knife('list --local /roles').should_succeed "/roles/z.json\n"
+ knife("list --local /roles").should_succeed "/roles/z.json\n"
end
- it 'knife raw -z -i empty.json -m POST /users' do
+ it "knife raw -z -i empty.json -m POST /users" do
knife("raw -z -i #{path_to('empty.json')} -m POST /users").should_succeed( /uri/ )
- knife('list --local /users').should_succeed "/users/z.json\n"
+ knife("list --local /users").should_succeed "/users/z.json\n"
end
- it 'After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty', :skip => (RUBY_VERSION < "1.9") do
+ it "After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty", :skip => (RUBY_VERSION < "1.9") do
knife("raw -z -i #{path_to('rolestuff.json')} -m POST /roles").should_succeed( /uri/ )
- expect(IO.read(path_to('roles/x.json'))).to eq <<EOM.strip
+ expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
"name": "x",
"description": "hi there"
@@ -261,8 +261,8 @@ EOM
end
end
- it 'knife list -z -R returns nothing' do
- knife('list -z -Rfp /').should_succeed <<EOM
+ it "knife list -z -R returns nothing" do
+ knife("list -z -Rfp /").should_succeed <<EOM
/clients/
/cookbooks/
/data_bags/
@@ -273,96 +273,96 @@ EOM
EOM
end
- context 'DELETE /TYPE/NAME' do
- it 'knife delete -z /clients/x.json fails with an error' do
- knife('delete -z /clients/x.json').should_fail "ERROR: /clients/x.json: No such file or directory\n"
+ context "DELETE /TYPE/NAME" do
+ it "knife delete -z /clients/x.json fails with an error" do
+ knife("delete -z /clients/x.json").should_fail "ERROR: /clients/x.json: No such file or directory\n"
end
- it 'knife delete -z -r /cookbooks/x fails with an error' do
- knife('delete -z -r /cookbooks/x').should_fail "ERROR: /cookbooks/x: No such file or directory\n"
+ it "knife delete -z -r /cookbooks/x fails with an error" do
+ knife("delete -z -r /cookbooks/x").should_fail "ERROR: /cookbooks/x: No such file or directory\n"
end
- it 'knife delete -z -r /data_bags/x fails with an error' do
- knife('delete -z -r /data_bags/x').should_fail "ERROR: /data_bags/x: No such file or directory\n"
+ it "knife delete -z -r /data_bags/x fails with an error" do
+ knife("delete -z -r /data_bags/x").should_fail "ERROR: /data_bags/x: No such file or directory\n"
end
- it 'knife delete -z /data_bags/x/y.json fails with an error' do
- knife('delete -z /data_bags/x/y.json').should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
+ it "knife delete -z /data_bags/x/y.json fails with an error" do
+ knife("delete -z /data_bags/x/y.json").should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
end
- it 'knife delete -z /environments/x.json fails with an error' do
- knife('delete -z /environments/x.json').should_fail "ERROR: /environments/x.json: No such file or directory\n"
+ it "knife delete -z /environments/x.json fails with an error" do
+ knife("delete -z /environments/x.json").should_fail "ERROR: /environments/x.json: No such file or directory\n"
end
- it 'knife delete -z /nodes/x.json fails with an error' do
- knife('delete -z /nodes/x.json').should_fail "ERROR: /nodes/x.json: No such file or directory\n"
+ it "knife delete -z /nodes/x.json fails with an error" do
+ knife("delete -z /nodes/x.json").should_fail "ERROR: /nodes/x.json: No such file or directory\n"
end
- it 'knife delete -z /roles/x.json fails with an error' do
- knife('delete -z /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ it "knife delete -z /roles/x.json fails with an error" do
+ knife("delete -z /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n"
end
- it 'knife delete -z /users/x.json fails with an error' do
- knife('delete -z /users/x.json').should_fail "ERROR: /users/x.json: No such file or directory\n"
+ it "knife delete -z /users/x.json fails with an error" do
+ knife("delete -z /users/x.json").should_fail "ERROR: /users/x.json: No such file or directory\n"
end
end
- context 'GET /TYPE/NAME' do
- it 'knife show -z /clients/x.json fails with an error' do
- knife('show -z /clients/x.json').should_fail "ERROR: /clients/x.json: No such file or directory\n"
+ context "GET /TYPE/NAME" do
+ it "knife show -z /clients/x.json fails with an error" do
+ knife("show -z /clients/x.json").should_fail "ERROR: /clients/x.json: No such file or directory\n"
end
- it 'knife show -z /cookbooks/x/metadata.rb fails with an error' do
- knife('show -z /cookbooks/x/metadata.rb').should_fail "ERROR: /cookbooks/x/metadata.rb: No such file or directory\n"
+ it "knife show -z /cookbooks/x/metadata.rb fails with an error" do
+ knife("show -z /cookbooks/x/metadata.rb").should_fail "ERROR: /cookbooks/x/metadata.rb: No such file or directory\n"
end
- it 'knife show -z /data_bags/x/y.json fails with an error' do
- knife('show -z /data_bags/x/y.json').should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
+ it "knife show -z /data_bags/x/y.json fails with an error" do
+ knife("show -z /data_bags/x/y.json").should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
end
- it 'knife show -z /environments/x.json fails with an error' do
- knife('show -z /environments/x.json').should_fail "ERROR: /environments/x.json: No such file or directory\n"
+ it "knife show -z /environments/x.json fails with an error" do
+ knife("show -z /environments/x.json").should_fail "ERROR: /environments/x.json: No such file or directory\n"
end
- it 'knife show -z /nodes/x.json fails with an error' do
- knife('show -z /nodes/x.json').should_fail "ERROR: /nodes/x.json: No such file or directory\n"
+ it "knife show -z /nodes/x.json fails with an error" do
+ knife("show -z /nodes/x.json").should_fail "ERROR: /nodes/x.json: No such file or directory\n"
end
- it 'knife show -z /roles/x.json fails with an error' do
- knife('show -z /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ it "knife show -z /roles/x.json fails with an error" do
+ knife("show -z /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n"
end
- it 'knife show -z /users/x.json fails with an error' do
- knife('show -z /users/x.json').should_fail "ERROR: /users/x.json: No such file or directory\n"
+ it "knife show -z /users/x.json fails with an error" do
+ knife("show -z /users/x.json").should_fail "ERROR: /users/x.json: No such file or directory\n"
end
end
- context 'PUT /TYPE/NAME' do
+ context "PUT /TYPE/NAME" do
before do
- file 'empty.json', {}
+ file "empty.json", {}
end
- it 'knife raw -z -i empty.json -m PUT /clients/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /clients/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /data/x/y fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /data/x/y fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /environments/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /environments/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /nodes/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /nodes/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /nodes/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /roles/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /roles/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /users/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /users/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_fail( /404/ )
end
end
diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb
index 31525cdf25..b5c86d7a00 100644
--- a/spec/integration/knife/chef_repo_path_spec.rb
+++ b/spec/integration/knife/chef_repo_path_spec.rb
@@ -15,49 +15,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
+require "chef/knife/show"
-describe 'chef_repo_path tests', :workstation do
+describe "chef_repo_path tests", :workstation do
include IntegrationSupport
include KnifeSupport
let(:error_rel_path_outside_repo) { /^ERROR: Attempt to use relative path '' when current directory is outside the repository path/ }
# TODO alternate repo_path / *_path
- context 'alternate *_path' do
- when_the_repository 'has clients and clients2, cookbooks and cookbooks2, etc.' do
+ context "alternate *_path" do
+ when_the_repository "has clients and clients2, cookbooks and cookbooks2, etc." do
before do
- file 'clients/client1.json', {}
- file 'cookbooks/cookbook1/metadata.rb', ''
- file 'data_bags/bag/item.json', {}
- file 'environments/env1.json', {}
- file 'nodes/node1.json', {}
- file 'roles/role1.json', {}
- file 'users/user1.json', {}
-
- file 'clients2/client2.json', {}
- file 'cookbooks2/cookbook2/metadata.rb', ''
- file 'data_bags2/bag2/item2.json', {}
- file 'environments2/env2.json', {}
- file 'nodes2/node2.json', {}
- file 'roles2/role2.json', {}
- file 'users2/user2.json', {}
-
- directory 'chef_repo2' do
- file 'clients/client3.json', {}
- file 'cookbooks/cookbook3/metadata.rb', ''
- file 'data_bags/bag3/item3.json', {}
- file 'environments/env3.json', {}
- file 'nodes/node3.json', {}
- file 'roles/role3.json', {}
- file 'users/user3.json', {}
+ file "clients/client1.json", {}
+ file "cookbooks/cookbook1/metadata.rb", ""
+ file "data_bags/bag/item.json", {}
+ file "environments/env1.json", {}
+ file "nodes/node1.json", {}
+ file "roles/role1.json", {}
+ file "users/user1.json", {}
+
+ file "clients2/client2.json", {}
+ file "cookbooks2/cookbook2/metadata.rb", ""
+ file "data_bags2/bag2/item2.json", {}
+ file "environments2/env2.json", {}
+ file "nodes2/node2.json", {}
+ file "roles2/role2.json", {}
+ file "users2/user2.json", {}
+
+ directory "chef_repo2" do
+ file "clients/client3.json", {}
+ file "cookbooks/cookbook3/metadata.rb", ""
+ file "data_bags/bag3/item3.json", {}
+ file "environments/env3.json", {}
+ file "nodes/node3.json", {}
+ file "roles/role3.json", {}
+ file "users/user3.json", {}
end
end
- it 'knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff' do
+ it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do
Chef::Config.delete(:chef_repo_path)
knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<EOM
/clients/
@@ -79,15 +79,15 @@ describe 'chef_repo_path tests', :workstation do
EOM
end
- context 'when all _paths are set to alternates' do
+ context "when all _paths are set to alternates" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2")
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- it 'knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff' do
+ it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do
knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<EOM
/clients/
/clients/client3.json
@@ -108,24 +108,24 @@ EOM
EOM
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client2.json
cookbooks/
@@ -146,31 +146,31 @@ EOM
end
end
- context 'when cwd is inside data_bags2' do
- before { cwd 'data_bags2' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside data_bags2" do
+ before { cwd "data_bags2" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag2/
bag2/item2.json
EOM
end
- it 'knife list --local -Rfp ../roles lists roles' do
- knife('list --local -Rfp ../roles').should_succeed "/roles/role2.json\n"
+ it "knife list --local -Rfp ../roles lists roles" do
+ knife("list --local -Rfp ../roles").should_succeed "/roles/role2.json\n"
end
end
end
- context 'when all _paths except chef_repo_path are set to alternates' do
+ context "when all _paths except chef_repo_path are set to alternates" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2")
end
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client2.json
cookbooks/
@@ -191,24 +191,24 @@ EOM
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside data_bags2' do
- before { cwd 'data_bags2' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside data_bags2" do
+ before { cwd "data_bags2" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag2/
bag2/item2.json
EOM
@@ -216,32 +216,32 @@ EOM
end
end
- context 'when only chef_repo_path is set to its alternate' do
+ context "when only chef_repo_path is set to its alternate" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client3.json
cookbooks/
@@ -262,10 +262,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag3/
bag3/item3.json
EOM
@@ -273,7 +273,7 @@ EOM
end
end
- context 'when paths are set to point to both versions of each' do
+ context "when paths are set to point to both versions of each" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = [
@@ -281,16 +281,16 @@ EOM
File.join(Chef::Config.chef_repo_path, "#{object_name}s2"),
]
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- context 'when there is a directory in clients1 and file in clients2 with the same name' do
+ context "when there is a directory in clients1 and file in clients2 with the same name" do
before do
- directory 'clients/blah.json'
- file 'clients2/blah.json', {}
+ directory "clients/blah.json"
+ file "clients2/blah.json", {}
end
- it 'knife show /clients/blah.json succeeds' do
- knife('show --local /clients/blah.json').should_succeed <<EOM
+ it "knife show /clients/blah.json succeeds" do
+ knife("show --local /clients/blah.json").should_succeed <<EOM
/clients/blah.json:
{
@@ -299,13 +299,13 @@ EOM
end
end
- context 'when there is a file in cookbooks1 and directory in cookbooks2 with the same name' do
+ context "when there is a file in cookbooks1 and directory in cookbooks2 with the same name" do
before do
- file 'cookbooks/blah', ''
- file 'cookbooks2/blah/metadata.rb', ''
+ file "cookbooks/blah", ""
+ file "cookbooks2/blah/metadata.rb", ""
end
- it 'knife list -Rfp cookbooks shows files in blah' do
- knife('list --local -Rfp /cookbooks').should_succeed <<EOM
+ it "knife list -Rfp cookbooks shows files in blah" do
+ knife("list --local -Rfp /cookbooks").should_succeed <<EOM
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/cookbook1/
@@ -316,13 +316,13 @@ EOM
end
end
- context 'when there is an empty directory in cookbooks1 and a real cookbook in cookbooks2 with the same name' do
+ context "when there is an empty directory in cookbooks1 and a real cookbook in cookbooks2 with the same name" do
before do
- directory 'cookbooks/blah'
- file 'cookbooks2/blah/metadata.rb', ''
+ directory "cookbooks/blah"
+ file "cookbooks2/blah/metadata.rb", ""
end
- it 'knife list -Rfp cookbooks shows files in blah' do
- knife('list --local -Rfp /cookbooks').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n")
+ it "knife list -Rfp cookbooks shows files in blah" do
+ knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n")
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/cookbook1/
@@ -333,13 +333,13 @@ EOM
end
end
- context 'when there is a cookbook in cookbooks1 and a cookbook in cookbooks2 with the same name' do
+ context "when there is a cookbook in cookbooks1 and a cookbook in cookbooks2 with the same name" do
before do
- file 'cookbooks/blah/metadata.json', {}
- file 'cookbooks2/blah/metadata.rb', ''
+ file "cookbooks/blah/metadata.json", {}
+ file "cookbooks2/blah/metadata.rb", ""
end
- it 'knife list -Rfp cookbooks shows files in the first cookbook and not the second' do
- knife('list --local -Rfp /cookbooks').should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n")
+ it "knife list -Rfp cookbooks shows files in the first cookbook and not the second" do
+ knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n")
/cookbooks/blah/
/cookbooks/blah/metadata.json
/cookbooks/cookbook1/
@@ -350,13 +350,13 @@ EOM
end
end
- context 'when there is a file in data_bags1 and a directory in data_bags2 with the same name' do
+ context "when there is a file in data_bags1 and a directory in data_bags2 with the same name" do
before do
- file 'data_bags/blah', ''
- file 'data_bags2/blah/item.json', ''
+ file "data_bags/blah", ""
+ file "data_bags2/blah/item.json", ""
end
- it 'knife list -Rfp data_bags shows files in blah' do
- knife('list --local -Rfp /data_bags').should_succeed <<EOM
+ it "knife list -Rfp data_bags shows files in blah" do
+ knife("list --local -Rfp /data_bags").should_succeed <<EOM
/data_bags/bag/
/data_bags/bag/item.json
/data_bags/bag2/
@@ -367,13 +367,13 @@ EOM
end
end
- context 'when there is a data bag in data_bags1 and a data bag in data_bags2 with the same name' do
+ context "when there is a data bag in data_bags1 and a data bag in data_bags2 with the same name" do
before do
- file 'data_bags/blah/item1.json', ''
- file 'data_bags2/blah/item2.json', ''
+ file "data_bags/blah/item1.json", ""
+ file "data_bags2/blah/item2.json", ""
end
- it 'knife list -Rfp data_bags shows only items in data_bags1' do
- knife('list --local -Rfp /data_bags').should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n")
+ it "knife list -Rfp data_bags shows only items in data_bags1" do
+ knife("list --local -Rfp /data_bags").should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n")
/data_bags/bag/
/data_bags/bag/item.json
/data_bags/bag2/
@@ -384,13 +384,13 @@ EOM
end
end
- context 'when there is a directory in environments1 and file in environments2 with the same name' do
+ context "when there is a directory in environments1 and file in environments2 with the same name" do
before do
- directory 'environments/blah.json'
- file 'environments2/blah.json', {}
+ directory "environments/blah.json"
+ file "environments2/blah.json", {}
end
- it 'knife show /environments/blah.json succeeds' do
- knife('show --local /environments/blah.json').should_succeed <<EOM
+ it "knife show /environments/blah.json succeeds" do
+ knife("show --local /environments/blah.json").should_succeed <<EOM
/environments/blah.json:
{
@@ -399,13 +399,13 @@ EOM
end
end
- context 'when there is a directory in nodes1 and file in nodes2 with the same name' do
+ context "when there is a directory in nodes1 and file in nodes2 with the same name" do
before do
- directory 'nodes/blah.json'
- file 'nodes2/blah.json', {}
+ directory "nodes/blah.json"
+ file "nodes2/blah.json", {}
end
- it 'knife show /nodes/blah.json succeeds' do
- knife('show --local /nodes/blah.json').should_succeed <<EOM
+ it "knife show /nodes/blah.json succeeds" do
+ knife("show --local /nodes/blah.json").should_succeed <<EOM
/nodes/blah.json:
{
@@ -414,13 +414,13 @@ EOM
end
end
- context 'when there is a directory in roles1 and file in roles2 with the same name' do
+ context "when there is a directory in roles1 and file in roles2 with the same name" do
before do
- directory 'roles/blah.json'
- file 'roles2/blah.json', {}
+ directory "roles/blah.json"
+ file "roles2/blah.json", {}
end
- it 'knife show /roles/blah.json succeeds' do
- knife('show --local /roles/blah.json').should_succeed <<EOM
+ it "knife show /roles/blah.json succeeds" do
+ knife("show --local /roles/blah.json").should_succeed <<EOM
/roles/blah.json:
{
@@ -429,13 +429,13 @@ EOM
end
end
- context 'when there is a directory in users1 and file in users2 with the same name' do
+ context "when there is a directory in users1 and file in users2 with the same name" do
before do
- directory 'users/blah.json'
- file 'users2/blah.json', {}
+ directory "users/blah.json"
+ file "users2/blah.json", {}
end
- it 'knife show /users/blah.json succeeds' do
- knife('show --local /users/blah.json').should_succeed <<EOM
+ it "knife show /users/blah.json succeeds" do
+ knife("show --local /users/blah.json").should_succeed <<EOM
/users/blah.json:
{
@@ -444,17 +444,17 @@ EOM
end
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag2/
@@ -463,10 +463,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client2.json
@@ -496,10 +496,10 @@ EOM
end
end
- context 'when cwd is inside data_bags2' do
- before { cwd 'data_bags2' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside data_bags2" do
+ before { cwd "data_bags2" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag2/
@@ -509,21 +509,21 @@ EOM
end
end
- context 'when when chef_repo_path is set to both places and no other _path is set' do
+ context "when when chef_repo_path is set to both places and no other _path is set" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.chef_repo_path = [
Chef::Config.chef_repo_path,
- File.join(Chef::Config.chef_repo_path, 'chef_repo2'),
+ File.join(Chef::Config.chef_repo_path, "chef_repo2"),
]
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -553,10 +553,10 @@ EOM
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -565,10 +565,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -598,10 +598,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -611,33 +611,33 @@ EOM
end
end
- context 'when cookbook_path is set and nothing else' do
+ context "when cookbook_path is set and nothing else" do
before :each do
%w(client data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
- Chef::Config.cookbook_path = File.join(@repository_dir, 'chef_repo2', 'cookbooks')
+ Chef::Config.cookbook_path = File.join(@repository_dir, "chef_repo2", "cookbooks")
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client3.json
cookbooks/
@@ -658,10 +658,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag3/
bag3/item3.json
EOM
@@ -669,22 +669,22 @@ EOM
end
end
- context 'when cookbook_path is set to multiple places and nothing else is set' do
+ context "when cookbook_path is set to multiple places and nothing else is set" do
before :each do
%w(client data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
Chef::Config.cookbook_path = [
- File.join(@repository_dir, 'cookbooks'),
- File.join(@repository_dir, 'chef_repo2', 'cookbooks'),
+ File.join(@repository_dir, "cookbooks"),
+ File.join(@repository_dir, "chef_repo2", "cookbooks"),
]
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -714,10 +714,10 @@ EOM
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -726,10 +726,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -759,10 +759,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -772,36 +772,36 @@ EOM
end
end
- context 'when data_bag_path and chef_repo_path are set, and nothing else' do
+ context "when data_bag_path and chef_repo_path are set, and nothing else" do
before :each do
%w(client cookbook environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
- Chef::Config.data_bag_path = File.join(Chef::Config.chef_repo_path, 'data_bags')
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.data_bag_path = File.join(Chef::Config.chef_repo_path, "data_bags")
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client3.json
cookbooks/
@@ -822,15 +822,15 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
end
- context 'when data_bag_path is set and nothing else' do
+ context "when data_bag_path is set and nothing else" do
include_context "default config options"
before :each do
@@ -838,28 +838,28 @@ EOM
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
- Chef::Config.data_bag_path = File.join(@repository_dir, 'data_bags')
+ Chef::Config.data_bag_path = File.join(@repository_dir, "data_bags")
end
- it 'knife list --local -Rfp / lists data bags' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "knife list --local -Rfp / lists data bags" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
/data_bags/bag/
/data_bags/bag/item.json
EOM
end
- it 'knife list --local -Rfp /data_bags lists data bags' do
- knife('list --local -Rfp /data_bags').should_succeed <<EOM
+ it "knife list --local -Rfp /data_bags lists data bags" do
+ knife("list --local -Rfp /data_bags").should_succeed <<EOM
/data_bags/bag/
/data_bags/bag/item.json
EOM
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
EOM
@@ -868,21 +868,21 @@ EOM
end
end
- when_the_repository 'is empty' do
- context 'when the repository _paths point to places that do not exist' do
+ when_the_repository "is empty" do
+ context "when the repository _paths point to places that do not exist" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
- Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, 'nowhere', object_name)
+ Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "nowhere", object_name)
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'nowhere')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "nowhere")
end
- it 'knife list --local -Rfp / fails' do
- knife('list --local -Rfp /').should_succeed ''
+ it "knife list --local -Rfp / fails" do
+ knife("list --local -Rfp /").should_succeed ""
end
- it 'knife list --local -Rfp /data_bags fails' do
- knife('list --local -Rfp /data_bags').should_fail("ERROR: /data_bags: No such file or directory\n")
+ it "knife list --local -Rfp /data_bags fails" do
+ knife("list --local -Rfp /data_bags").should_fail("ERROR: /data_bags: No such file or directory\n")
end
end
end
diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb
index 34afd228f3..dc33d299e1 100644
--- a/spec/integration/knife/chef_repository_file_system_spec.rb
+++ b/spec/integration/knife/chef_repository_file_system_spec.rb
@@ -15,15 +15,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/list'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "chef/knife/list"
+require "chef/knife/show"
-describe 'General chef_repo file system checks', :workstation do
+describe "General chef_repo file system checks", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'directories and files that should/should not be ignored' do
+ context "directories and files that should/should not be ignored" do
when_the_repository "has empty roles, environments and data bag item directories" do
before do
directory "roles"
@@ -32,7 +32,7 @@ describe 'General chef_repo file system checks', :workstation do
end
it "knife list --local -Rfp / returns them" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
/data_bags/bag1/
/environments/
@@ -45,25 +45,25 @@ EOM
before { directory "data_bags" }
it "knife list --local / returns it" do
- knife('list --local /').should_succeed "/data_bags\n"
+ knife("list --local /").should_succeed "/data_bags\n"
end
end
when_the_repository "has an empty cookbook directory" do
- before { directory 'cookbooks/cookbook1' }
+ before { directory "cookbooks/cookbook1" }
it "knife list --local -Rfp / does not return it" do
- knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
end
when_the_repository "has only empty cookbook subdirectories" do
- before { directory 'cookbooks/cookbook1/recipes' }
+ before { directory "cookbooks/cookbook1/recipes" }
it "knife list --local -Rfp / does not return it" do
- knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
@@ -71,12 +71,12 @@ EOM
when_the_repository "has empty and non-empty cookbook subdirectories" do
before do
- directory 'cookbooks/cookbook1/recipes'
- file 'cookbooks/cookbook1/templates/default/x.txt', ''
+ directory "cookbooks/cookbook1/recipes"
+ file "cookbooks/cookbook1/templates/default/x.txt", ""
end
it "knife list --local -Rfp / does not return the empty ones" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/templates/
@@ -87,10 +87,10 @@ EOM
end
when_the_repository "has only empty cookbook sub-sub-directories" do
- before { directory 'cookbooks/cookbook1/templates/default' }
+ before { directory "cookbooks/cookbook1/templates/default" }
it "knife list --local -Rfp / does not return it" do
- knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
@@ -98,13 +98,13 @@ EOM
when_the_repository "has empty cookbook sub-sub-directories alongside non-empty ones" do
before do
- file 'cookbooks/cookbook1/templates/default/x.txt', ''
- directory 'cookbooks/cookbook1/templates/rhel'
- directory 'cookbooks/cookbook1/files/default'
+ file "cookbooks/cookbook1/templates/default/x.txt", ""
+ directory "cookbooks/cookbook1/templates/rhel"
+ directory "cookbooks/cookbook1/files/default"
end
it "knife list --local -Rfp / does not return the empty ones" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/templates/
@@ -122,7 +122,7 @@ EOM
end
it "knife list --local -Rfp / should NOT return it" do
- knife('list --local -Rfp /').should_succeed ""
+ knife("list --local -Rfp /").should_succeed ""
end
end
@@ -146,7 +146,7 @@ EOM
end
it "knife list --local -Rfp / should NOT return them" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
/data_bags/bag1/
/data_bags/bag1/item1.json
@@ -160,62 +160,62 @@ EOM
when_the_repository "has extraneous subdirectories and files under a cookbook" do
before do
- directory 'cookbooks/cookbook1' do
- file 'a.rb', ''
- file 'blarghle/blah.rb', ''
- directory 'attributes' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "cookbooks/cookbook1" do
+ file "a.rb", ""
+ file "blarghle/blah.rb", ""
+ directory "attributes" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'definitions' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "definitions" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'recipes' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "recipes" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'libraries' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "libraries" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'templates' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "templates" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'files' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "files" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'resources' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "resources" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'providers' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "providers" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
end
end
it "knife list --local -Rfp / should NOT return them" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/a.rb
@@ -252,41 +252,41 @@ EOM
end
when_the_repository "has a file in cookbooks/" do
- before { file 'cookbooks/file', '' }
- it 'does not show up in list -Rfp' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ before { file "cookbooks/file", "" }
+ it "does not show up in list -Rfp" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
EOM
end
end
when_the_repository "has a file in data_bags/" do
- before { file 'data_bags/file', '' }
- it 'does not show up in list -Rfp' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ before { file "data_bags/file", "" }
+ it "does not show up in list -Rfp" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
EOM
end
end
end
- when_the_repository 'has a cookbook starting with .' do
+ when_the_repository "has a cookbook starting with ." do
before do
- file 'cookbooks/.svn/metadata.rb', ''
- file 'cookbooks/a.b/metadata.rb', ''
+ file "cookbooks/.svn/metadata.rb", ""
+ file "cookbooks/a.b/metadata.rb", ""
end
- it 'knife list does not show it' do
- knife('list --local -fp /cookbooks').should_succeed "/cookbooks/a.b/\n"
+ it "knife list does not show it" do
+ knife("list --local -fp /cookbooks").should_succeed "/cookbooks/a.b/\n"
end
end
- when_the_repository 'has a data bag starting with .' do
+ when_the_repository "has a data bag starting with ." do
before do
- file 'data_bags/.svn/x.json', {}
- file 'data_bags/a.b/x.json', {}
+ file "data_bags/.svn/x.json", {}
+ file "data_bags/a.b/x.json", {}
end
- it 'knife list does not show it' do
- knife('list --local -fp /data_bags').should_succeed "/data_bags/a.b/\n"
+ it "knife list does not show it" do
+ knife("list --local -fp /data_bags").should_succeed "/data_bags/a.b/\n"
end
end
end
diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb
index 10cfbbf557..3ffd0453e8 100644
--- a/spec/integration/knife/chefignore_spec.rb
+++ b/spec/integration/knife/chefignore_spec.rb
@@ -15,37 +15,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/list'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "chef/knife/list"
+require "chef/knife/show"
-describe 'chefignore tests', :workstation do
+describe "chefignore tests", :workstation do
include IntegrationSupport
include KnifeSupport
when_the_repository "has lots of stuff in it" do
before do
- file 'roles/x.json', {}
- file 'environments/x.json', {}
- file 'data_bags/bag1/x.json', {}
- file 'cookbooks/cookbook1/x.json', {}
+ file "roles/x.json", {}
+ file "environments/x.json", {}
+ file "data_bags/bag1/x.json", {}
+ file "cookbooks/cookbook1/x.json", {}
end
context "and has a chefignore everywhere except cookbooks" do
before do
chefignore = "x.json\nroles/x.json\nenvironments/x.json\ndata_bags/bag1/x.json\nbag1/x.json\ncookbooks/cookbook1/x.json\ncookbook1/x.json\n"
- file 'chefignore', chefignore
- file 'roles/chefignore', chefignore
- file 'environments/chefignore', chefignore
- file 'data_bags/chefignore', chefignore
- file 'data_bags/bag1/chefignore', chefignore
- file 'cookbooks/cookbook1/chefignore', chefignore
+ file "chefignore", chefignore
+ file "roles/chefignore", chefignore
+ file "environments/chefignore", chefignore
+ file "data_bags/chefignore", chefignore
+ file "data_bags/bag1/chefignore", chefignore
+ file "cookbooks/cookbook1/chefignore", chefignore
end
- it 'matching files and directories get ignored' do
+ it "matching files and directories get ignored" do
# NOTE: many of the "chefignore" files should probably not show up
# themselves, but we have other tests that talk about that
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/chefignore
@@ -61,15 +61,15 @@ EOM
end
end
- when_the_repository 'has a cookbook with only chefignored files' do
+ when_the_repository "has a cookbook with only chefignored files" do
before do
- file 'cookbooks/cookbook1/templates/default/x.rb', ''
- file 'cookbooks/cookbook1/libraries/x.rb', ''
- file 'cookbooks/chefignore', "libraries/x.rb\ntemplates/default/x.rb\n"
+ file "cookbooks/cookbook1/templates/default/x.rb", ""
+ file "cookbooks/cookbook1/libraries/x.rb", ""
+ file "cookbooks/chefignore", "libraries/x.rb\ntemplates/default/x.rb\n"
end
- it 'the cookbook is not listed' do
- knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ it "the cookbook is not listed" do
+ knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
@@ -77,17 +77,17 @@ EOM
when_the_repository "has multiple cookbooks" do
before do
- file 'cookbooks/cookbook1/x.json', {}
- file 'cookbooks/cookbook1/y.json', {}
- file 'cookbooks/cookbook2/x.json', {}
- file 'cookbooks/cookbook2/y.json', {}
+ file "cookbooks/cookbook1/x.json", {}
+ file "cookbooks/cookbook1/y.json", {}
+ file "cookbooks/cookbook2/x.json", {}
+ file "cookbooks/cookbook2/y.json", {}
end
- context 'and has a chefignore with filenames' do
- before { file 'cookbooks/chefignore', "x.json\n" }
+ context "and has a chefignore with filenames" do
+ before { file "cookbooks/chefignore", "x.json\n" }
- it 'matching files and directories get ignored in all cookbooks' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching files and directories get ignored in all cookbooks" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/y.json
@@ -99,12 +99,12 @@ EOM
context "and has a chefignore with wildcards" do
before do
- file 'cookbooks/chefignore', "x.*\n"
- file 'cookbooks/cookbook1/x.rb', ''
+ file "cookbooks/chefignore", "x.*\n"
+ file "cookbooks/cookbook1/x.rb", ""
end
- it 'matching files and directories get ignored in all cookbooks' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching files and directories get ignored in all cookbooks" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/y.json
@@ -116,13 +116,13 @@ EOM
context "and has a chefignore with relative paths" do
before do
- file 'cookbooks/cookbook1/recipes/x.rb', ''
- file 'cookbooks/cookbook2/recipes/y.rb', ''
- file 'cookbooks/chefignore', "recipes/x.rb\n"
+ file "cookbooks/cookbook1/recipes/x.rb", ""
+ file "cookbooks/cookbook2/recipes/y.rb", ""
+ file "cookbooks/chefignore", "recipes/x.rb\n"
end
- it 'matching directories get ignored' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching directories get ignored" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/x.json
@@ -138,12 +138,12 @@ EOM
context "and has a chefignore with subdirectories" do
before do
- file 'cookbooks/cookbook1/recipes/y.rb', ''
- file 'cookbooks/chefignore', "recipes\nrecipes/\n"
+ file "cookbooks/cookbook1/recipes/y.rb", ""
+ file "cookbooks/chefignore", "recipes\nrecipes/\n"
end
- it 'matching directories do NOT get ignored' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching directories do NOT get ignored" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/recipes/
@@ -159,13 +159,13 @@ EOM
context "and has a chefignore that ignores all files in a subdirectory" do
before do
- file 'cookbooks/cookbook1/templates/default/x.rb', ''
- file 'cookbooks/cookbook1/libraries/x.rb', ''
- file 'cookbooks/chefignore', "libraries/x.rb\ntemplates/default/x.rb\n"
+ file "cookbooks/cookbook1/templates/default/x.rb", ""
+ file "cookbooks/cookbook1/libraries/x.rb", ""
+ file "cookbooks/chefignore", "libraries/x.rb\ntemplates/default/x.rb\n"
end
- it 'ignores the subdirectory entirely' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "ignores the subdirectory entirely" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/x.json
@@ -179,11 +179,11 @@ EOM
context "and has an empty chefignore" do
before do
- file 'cookbooks/chefignore', "\n"
+ file "cookbooks/chefignore", "\n"
end
- it 'nothing is ignored' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "nothing is ignored" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/x.json
@@ -197,11 +197,11 @@ EOM
context "and has a chefignore with comments and empty lines" do
before do
- file 'cookbooks/chefignore', "\n\n # blah\n#\nx.json\n\n"
+ file "cookbooks/chefignore", "\n\n # blah\n#\nx.json\n\n"
end
- it 'matching files and directories get ignored in all cookbooks' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching files and directories get ignored in all cookbooks" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/y.json
@@ -215,25 +215,25 @@ EOM
when_the_repository "has multiple cookbook paths" do
before :each do
Chef::Config.cookbook_path = [
- File.join(Chef::Config.chef_repo_path, 'cookbooks1'),
- File.join(Chef::Config.chef_repo_path, 'cookbooks2'),
+ File.join(Chef::Config.chef_repo_path, "cookbooks1"),
+ File.join(Chef::Config.chef_repo_path, "cookbooks2"),
]
end
before do
- file 'cookbooks1/mycookbook/metadata.rb', ''
- file 'cookbooks1/mycookbook/x.json', {}
- file 'cookbooks2/yourcookbook/metadata.rb', ''
- file 'cookbooks2/yourcookbook/x.json', ''
+ file "cookbooks1/mycookbook/metadata.rb", ""
+ file "cookbooks1/mycookbook/x.json", {}
+ file "cookbooks2/yourcookbook/metadata.rb", ""
+ file "cookbooks2/yourcookbook/x.json", ""
end
context "and multiple chefignores" do
before do
- file 'cookbooks1/chefignore', "metadata.rb\n"
- file 'cookbooks2/chefignore', "x.json\n"
+ file "cookbooks1/chefignore", "metadata.rb\n"
+ file "cookbooks2/chefignore", "x.json\n"
end
it "chefignores apply only to the directories they are in" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/mycookbook/
/cookbooks/mycookbook/x.json
@@ -244,14 +244,14 @@ EOM
context "and conflicting cookbooks" do
before do
- file 'cookbooks1/yourcookbook/metadata.rb', ''
- file 'cookbooks1/yourcookbook/x.json', ''
- file 'cookbooks1/yourcookbook/onlyincookbooks1.rb', ''
- file 'cookbooks2/yourcookbook/onlyincookbooks2.rb', ''
+ file "cookbooks1/yourcookbook/metadata.rb", ""
+ file "cookbooks1/yourcookbook/x.json", ""
+ file "cookbooks1/yourcookbook/onlyincookbooks1.rb", ""
+ file "cookbooks2/yourcookbook/onlyincookbooks2.rb", ""
end
it "chefignores apply only to the winning cookbook" do
- knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n")
/cookbooks/
/cookbooks/mycookbook/
/cookbooks/mycookbook/x.json
@@ -264,32 +264,32 @@ EOM
end
end
- when_the_repository 'has a cookbook named chefignore' do
+ when_the_repository "has a cookbook named chefignore" do
before do
- file 'cookbooks/chefignore/metadata.rb', {}
+ file "cookbooks/chefignore/metadata.rb", {}
end
- it 'knife list -Rfp /cookbooks shows it' do
- knife('list --local -Rfp /cookbooks').should_succeed <<EOM
+ it "knife list -Rfp /cookbooks shows it" do
+ knife("list --local -Rfp /cookbooks").should_succeed <<EOM
/cookbooks/chefignore/
/cookbooks/chefignore/metadata.rb
EOM
end
end
- when_the_repository 'has multiple cookbook paths, one with a chefignore file and the other with a cookbook named chefignore' do
+ when_the_repository "has multiple cookbook paths, one with a chefignore file and the other with a cookbook named chefignore" do
before do
- file 'cookbooks1/chefignore', ''
- file 'cookbooks1/blah/metadata.rb', ''
- file 'cookbooks2/chefignore/metadata.rb', ''
+ file "cookbooks1/chefignore", ""
+ file "cookbooks1/blah/metadata.rb", ""
+ file "cookbooks2/chefignore/metadata.rb", ""
end
before :each do
Chef::Config.cookbook_path = [
- File.join(Chef::Config.chef_repo_path, 'cookbooks1'),
- File.join(Chef::Config.chef_repo_path, 'cookbooks2'),
+ File.join(Chef::Config.chef_repo_path, "cookbooks1"),
+ File.join(Chef::Config.chef_repo_path, "cookbooks2"),
]
end
- it 'knife list -Rfp /cookbooks shows the chefignore cookbook' do
- knife('list --local -Rfp /cookbooks').should_succeed <<EOM
+ it "knife list -Rfp /cookbooks shows the chefignore cookbook" do
+ knife("list --local -Rfp /cookbooks").should_succeed <<EOM
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/chefignore/
diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb
index b2e2e3fc2a..0c287580db 100644
--- a/spec/integration/knife/common_options_spec.rb
+++ b/spec/integration/knife/common_options_spec.rb
@@ -15,46 +15,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/raw'
+require "support/shared/integration/integration_helper"
+require "chef/knife/raw"
-describe 'knife common options', :workstation do
+describe "knife common options", :workstation do
include IntegrationSupport
include KnifeSupport
when_the_repository "has a node" do
- before { file 'nodes/x.json', {} }
+ before { file "nodes/x.json", {} }
- context 'When chef_zero.enabled is true' do
+ context "When chef_zero.enabled is true" do
before(:each) do
Chef::Config.chef_zero.enabled = true
end
- it 'knife raw /nodes/x should retrieve the node' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw /nodes/x should retrieve the node" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
end
- context 'And chef_zero.port is 9999' do
+ context "And chef_zero.port is 9999" do
before(:each) { Chef::Config.chef_zero.port = 9999 }
- it 'knife raw /nodes/x should retrieve the node' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
- expect(Chef::Config.chef_server_url).to eq('chefzero://localhost:9999')
+ it "knife raw /nodes/x should retrieve the node" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
+ expect(Chef::Config.chef_server_url).to eq("chefzero://localhost:9999")
end
end
# 0.0.0.0 is not a valid address to bind to on windows.
- context 'And chef_zero.host is 0.0.0.0', :unix_only do
- before(:each) { Chef::Config.chef_zero.host = '0.0.0.0' }
+ context "And chef_zero.host is 0.0.0.0", :unix_only do
+ before(:each) { Chef::Config.chef_zero.host = "0.0.0.0" }
- it 'knife raw /nodes/x should retrieve the role' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw /nodes/x should retrieve the role" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
end
end
- context 'and there is a private key' do
+ context "and there is a private key" do
before do
- file 'mykey.pem', <<EOM
+ file "mykey.pem", <<EOM
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf
0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk
@@ -85,29 +85,29 @@ syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T
EOM
end
- it 'knife raw /nodes/x should retrieve the node' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw /nodes/x should retrieve the node" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
end
end
end
- it 'knife raw -z /nodes/x retrieves the node' do
- knife('raw -z /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z /nodes/x retrieves the node" do
+ knife("raw -z /nodes/x").should_succeed( /"name": "x"/ )
end
- it 'knife raw --local-mode /nodes/x retrieves the node' do
- knife('raw --local-mode /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw --local-mode /nodes/x retrieves the node" do
+ knife("raw --local-mode /nodes/x").should_succeed( /"name": "x"/ )
end
- it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do
- knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed( /"name": "x"/ )
- expect(Chef::Config.chef_server_url).to eq('chefzero://localhost:9999')
+ it "knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node" do
+ knife("raw -z --chef-zero-port=9999 /nodes/x").should_succeed( /"name": "x"/ )
+ expect(Chef::Config.chef_server_url).to eq("chefzero://localhost:9999")
end
- context 'when the default port (8889) is already bound' do
+ context "when the default port (8889) is already bound" do
before :each do
begin
- @server = ChefZero::Server.new(:host => 'localhost', :port => 8889)
+ @server = ChefZero::Server.new(:host => "localhost", :port => 8889)
@server.start_background
rescue Errno::EADDRINUSE
# OK. Don't care who has it in use, as long as *someone* does.
@@ -117,16 +117,16 @@ EOM
@server.stop if @server
end
- it 'knife raw -z /nodes/x retrieves the node' do
- knife('raw -z /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z /nodes/x retrieves the node" do
+ knife("raw -z /nodes/x").should_succeed( /"name": "x"/ )
expect(URI(Chef::Config.chef_server_url).port).to be > 8889
end
end
- context 'when port 9999 is already bound' do
+ context "when port 9999 is already bound" do
before :each do
begin
- @server = ChefZero::Server.new(:host => 'localhost', :port => 9999)
+ @server = ChefZero::Server.new(:host => "localhost", :port => 9999)
@server.start_background
rescue Errno::EADDRINUSE
# OK. Don't care who has it in use, as long as *someone* does.
@@ -136,20 +136,20 @@ EOM
@server.stop if @server
end
- it 'knife raw -z --chef-zero-port=9999-20000 /nodes/x' do
- knife('raw -z --chef-zero-port=9999-20000 /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z --chef-zero-port=9999-20000 /nodes/x" do
+ knife("raw -z --chef-zero-port=9999-20000 /nodes/x").should_succeed( /"name": "x"/ )
expect(URI(Chef::Config.chef_server_url).port).to be > 9999
end
- it 'knife raw -z --chef-zero-port=9999-9999,19423' do
- knife('raw -z --chef-zero-port=9999-9999,19423 /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z --chef-zero-port=9999-9999,19423" do
+ knife("raw -z --chef-zero-port=9999-9999,19423 /nodes/x").should_succeed( /"name": "x"/ )
expect(URI(Chef::Config.chef_server_url).port).to be == 19423
end
end
- it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do
- knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed( /"name": "x"/ )
- expect(Chef::Config.chef_server_url).to eq('chefzero://localhost:9999')
+ it "knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node" do
+ knife("raw -z --chef-zero-port=9999 /nodes/x").should_succeed( /"name": "x"/ )
+ expect(Chef::Config.chef_server_url).to eq("chefzero://localhost:9999")
end
end
end
diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb
index 4b44c87fc1..3033c4cf4a 100644
--- a/spec/integration/knife/cookbook_api_ipv6_spec.rb
+++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "Knife cookbook API integration with IPv6", :workstation, :not_supported_on_gce do
include IntegrationSupport
@@ -84,8 +84,8 @@ END_CLIENT_RB
end
before do
- file 'config/knife.rb', knife_rb_content
- file 'config/knifeuser.pem', client_key
+ file "config/knife.rb", knife_rb_content
+ file "config/knifeuser.pem", client_key
end
it "successfully uploads a cookbook" do
diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb
index 384f06cf83..3a1a93fb51 100644
--- a/spec/integration/knife/delete_spec.rb
+++ b/spec/integration/knife/delete_spec.rb
@@ -15,12 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/delete'
-require 'chef/knife/list'
-require 'chef/knife/raw'
+require "support/shared/integration/integration_helper"
+require "chef/knife/delete"
+require "chef/knife/list"
+require "chef/knife/raw"
-describe 'knife delete', :workstation do
+describe "knife delete", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -100,39 +100,39 @@ EOM
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'also has one of each thing' do
+ when_the_repository "also has one of each thing" do
before do
- file 'clients/x.json', {}
- file 'cookbooks/x/metadata.rb', ''
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', {}
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/x.json', {}
- end
-
- it 'knife delete --both /cookbooks/x fails' do
- knife('delete --both /cookbooks/x').should_fail <<EOM
+ file "clients/x.json", {}
+ file "cookbooks/x/metadata.rb", ""
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", {}
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/x.json", {}
+ end
+
+ it "knife delete --both /cookbooks/x fails" do
+ knife("delete --both /cookbooks/x").should_fail <<EOM
ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete.
ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /cookbooks/x deletes x' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /cookbooks/x deletes x" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -152,7 +152,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -171,10 +171,10 @@ EOM
EOM
end
- it 'knife delete -r --local /cookbooks/x deletes x locally but not remotely' do
- knife('delete -r --local /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete -r --local /cookbooks/x deletes x locally but not remotely" do
+ knife("delete -r --local /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -193,9 +193,9 @@ EOM
EOM
end
- it 'knife delete -r /cookbooks/x deletes x remotely but not locally' do
- knife('delete -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete -r /cookbooks/x deletes x remotely but not locally" do
+ knife("delete -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -215,22 +215,22 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf --local /").should_succeed everything
end
# TODO delete empty data bag (particularly different on local side)
- context 'with an empty data bag on both' do
+ context "with an empty data bag on both" do
before do
- data_bag 'empty', {}
- directory 'data_bags/empty'
+ data_bag "empty", {}
+ directory "data_bags/empty"
end
- it 'knife delete --both /data_bags/empty fails but deletes local version' do
- knife('delete --both /data_bags/empty').should_fail <<EOM
+ it "knife delete --both /data_bags/empty fails but deletes local version" do
+ knife("delete --both /data_bags/empty").should_fail <<EOM
ERROR: /data_bags/empty (remote) must be deleted recursively! Pass -r to knife delete.
ERROR: /data_bags/empty (local) must be deleted recursively! Pass -r to knife delete.
EOM
- knife('list -Rf /').should_succeed <<EOM
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -253,7 +253,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -276,18 +276,18 @@ EOM
end
end
- it 'knife delete --both /data_bags/x fails' do
- knife('delete --both /data_bags/x').should_fail <<EOM
+ it "knife delete --both /data_bags/x fails" do
+ knife("delete --both /data_bags/x").should_fail <<EOM
ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete.
ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /data_bags/x deletes x' do
- knife('delete --both -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /data_bags/x deletes x" do
+ knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -307,7 +307,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -326,9 +326,9 @@ EOM
EOM
end
- it 'knife delete --both /environments/x.json deletes x' do
- knife('delete --both /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /environments/x.json deletes x" do
+ knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -349,7 +349,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -369,9 +369,9 @@ EOM
EOM
end
- it 'knife delete --both /roles/x.json deletes x' do
- knife('delete --both /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /roles/x.json deletes x" do
+ knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -392,7 +392,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -412,10 +412,10 @@ EOM
EOM
end
- it 'knife delete --both /environments/_default.json fails but still deletes the local copy' do
- knife('delete --both /environments/_default.json').should_fail :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", :stdout => "Deleted /environments/_default.json\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both /environments/_default.json fails but still deletes the local copy" do
+ knife("delete --both /environments/_default.json").should_fail :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", :stdout => "Deleted /environments/_default.json\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -435,23 +435,23 @@ EOM
EOM
end
- it 'knife delete --both /environments/nonexistent.json fails' do
- knife('delete --both /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both /environments/nonexistent.json fails" do
+ knife("delete --both /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both / fails' do
- knife('delete --both /').should_fail <<EOM
+ it "knife delete --both / fails" do
+ knife("delete --both /").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /* fails' do
- knife('delete --both -r /*').should_fail <<EOM
+ it "knife delete --both -r /* fails" do
+ knife("delete --both -r /*").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
ERROR: /clients (remote) cannot be deleted.
@@ -469,31 +469,31 @@ ERROR: /roles (local) cannot be deleted.
ERROR: /users (remote) cannot be deleted.
ERROR: /users (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife delete --both /cookbooks/x fails' do
- knife('delete --both /cookbooks/x').should_fail "ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /cookbooks/x fails" do
+ knife("delete --both /cookbooks/x").should_fail "ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both -r /cookbooks/x deletes x' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /cookbooks/x deletes x" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -513,18 +513,18 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /data_bags/x fails' do
- knife('delete --both /data_bags/x').should_fail "ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /data_bags/x fails" do
+ knife("delete --both /data_bags/x").should_fail "ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both -r /data_bags/x deletes x' do
- knife('delete --both -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /data_bags/x deletes x" do
+ knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -544,12 +544,12 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /environments/x.json deletes x' do
- knife('delete --both /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /environments/x.json deletes x" do
+ knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -570,12 +570,12 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /roles/x.json deletes x' do
- knife('delete --both /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /roles/x.json deletes x" do
+ knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -596,23 +596,23 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /environments/_default.json fails' do
- knife('delete --both /environments/_default.json').should_fail "", :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /environments/_default.json fails" do
+ knife("delete --both /environments/_default.json").should_fail "", :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both / fails' do
- knife('delete --both /').should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both / fails" do
+ knife("delete --both /").should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both -r /* fails' do
- knife('delete --both -r /*').should_fail <<EOM
+ it "knife delete --both -r /* fails" do
+ knife("delete --both -r /*").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
ERROR: /clients (remote) cannot be deleted.
@@ -630,21 +630,21 @@ ERROR: /roles (local) cannot be deleted.
ERROR: /users (remote) cannot be deleted.
ERROR: /users (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /environments/nonexistent.json fails' do
- knife('delete --both /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /environments/nonexistent.json fails" do
+ knife("delete --both /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- context 'and cwd is at the top level' do
- before { cwd '.' }
- it 'knife delete fails' do
- knife('delete').should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
- knife('list -Rf /').should_succeed <<EOM
+ context "and cwd is at the top level" do
+ before { cwd "." }
+ it "knife delete fails" do
+ knife("delete").should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
+ knife("list -Rf /").should_succeed <<EOM
clients
clients/chef-validator.json
clients/chef-webui.json
@@ -666,7 +666,7 @@ users
users/admin.json
users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
clients
cookbooks
data_bags
@@ -680,29 +680,29 @@ EOM
end
end
- when_the_chef_server 'is empty' do
- when_the_repository 'has one of each thing' do
+ when_the_chef_server "is empty" do
+ when_the_repository "has one of each thing" do
before do
- file 'clients/x.json', {}
- file 'cookbooks/x/metadata.rb', ''
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', {}
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/x.json', {}
- end
-
- it 'knife delete --both /cookbooks/x fails' do
- knife('delete --both /cookbooks/x').should_fail "ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
- end
-
- it 'knife delete --both -r /cookbooks/x deletes x' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ file "clients/x.json", {}
+ file "cookbooks/x/metadata.rb", ""
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", {}
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/x.json", {}
+ end
+
+ it "knife delete --both /cookbooks/x fails" do
+ knife("delete --both /cookbooks/x").should_fail "ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
+ end
+
+ it "knife delete --both -r /cookbooks/x deletes x" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -721,16 +721,16 @@ EOM
EOM
end
- it 'knife delete --both /data_bags/x fails' do
- knife('delete --both /data_bags/x').should_fail "ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both /data_bags/x fails" do
+ knife("delete --both /data_bags/x").should_fail "ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /data_bags/x deletes x' do
- knife('delete --both -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both -r /data_bags/x deletes x" do
+ knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -749,10 +749,10 @@ EOM
EOM
end
- it 'knife delete --both /environments/x.json deletes x' do
- knife('delete --both /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both /environments/x.json deletes x" do
+ knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -772,10 +772,10 @@ EOM
EOM
end
- it 'knife delete --both /roles/x.json deletes x' do
- knife('delete --both /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both /roles/x.json deletes x" do
+ knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -795,10 +795,10 @@ EOM
EOM
end
- it 'knife delete --both /environments/_default.json fails but still deletes the local copy' do
- knife('delete --both /environments/_default.json').should_fail :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", :stdout => "Deleted /environments/_default.json\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both /environments/_default.json fails but still deletes the local copy" do
+ knife("delete --both /environments/_default.json").should_fail :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", :stdout => "Deleted /environments/_default.json\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -818,14 +818,14 @@ EOM
EOM
end
- it 'knife delete --both / fails' do
- knife('delete --both /').should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both / fails" do
+ knife("delete --both /").should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /* fails' do
- knife('delete --both -r /*').should_fail <<EOM
+ it "knife delete --both -r /* fails" do
+ knife("delete --both -r /*").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
ERROR: /clients (remote) cannot be deleted.
@@ -843,21 +843,21 @@ ERROR: /roles (local) cannot be deleted.
ERROR: /users (remote) cannot be deleted.
ERROR: /users (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both /environments/nonexistent.json fails' do
- knife('delete --both /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both /environments/nonexistent.json fails" do
+ knife("delete --both /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- context 'and cwd is at the top level' do
- before { cwd '.' }
- it 'knife delete fails' do
- knife('delete').should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
- knife('list -Rf /').should_succeed <<EOM
+ context "and cwd is at the top level" do
+ before { cwd "." }
+ it "knife delete fails" do
+ knife("delete").should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
+ knife("list -Rf /").should_succeed <<EOM
clients
clients/chef-validator.json
clients/chef-webui.json
@@ -870,7 +870,7 @@ roles
users
users/admin.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
clients
clients/x.json
cookbooks
@@ -894,124 +894,124 @@ EOM
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', 'version "1.0.0"'
- file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x/metadata.rb", 'version "1.0.0"'
+ file "cookbooks/x/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
# TODO this seems wrong
- it 'knife delete --both -r /cookbooks/x deletes the latest version on the server and the local version' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_succeed(/1.0.0/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both -r /cookbooks/x deletes the latest version on the server and the local version" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_succeed(/1.0.0/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife delete --both /cookbooks/x deletes the latest version on the server and the local version' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_succeed(/0.9.9/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both /cookbooks/x deletes the latest version on the server and the local version" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_succeed(/0.9.9/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
- before { cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' } }
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
+ before { cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" } }
- it 'knife delete --both /cookbooks/x deletes the server and client version of the cookbook' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_fail(/404/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both /cookbooks/x deletes the server and client version of the cookbook" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_fail(/404/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
- before { cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' } }
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
+ before { cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } }
- it 'knife delete --both /cookbooks/x deletes the server and client version of the cookbook' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_fail(/404/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both /cookbooks/x deletes the server and client version of the cookbook" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_fail(/404/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- when_the_chef_server 'has two versions of a cookbook' do
+ when_the_repository "is empty" do
+ when_the_chef_server "has two versions of a cookbook" do
before do
- cookbook 'x', '2.0.11'
- cookbook 'x', '11.0.0'
+ cookbook "x", "2.0.11"
+ cookbook "x", "11.0.0"
end
- it 'knife delete deletes the latest version' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_succeed( /2.0.11/ )
+ it "knife delete deletes the latest version" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_succeed( /2.0.11/ )
end
end
end
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- organization 'foo' do
- container 'x', {}
- group 'x', {}
- policy 'x', '1.2.3', {}
- policy_group 'x', { 'policies' => { 'x' => { 'revision_id' => '1.2.3' } } }
+ organization "foo" do
+ container "x", {}
+ group "x", {}
+ policy "x", "1.2.3", {}
+ policy_group "x", { "policies" => { "x" => { "revision_id" => "1.2.3" } } }
end
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- it 'knife delete /acls/containers/environments.json fails with a reasonable error' do
- knife('delete /acls/containers/environments.json').should_fail "ERROR: /acls/containers/environments.json (remote) ACLs cannot be deleted.\n"
+ it "knife delete /acls/containers/environments.json fails with a reasonable error" do
+ knife("delete /acls/containers/environments.json").should_fail "ERROR: /acls/containers/environments.json (remote) ACLs cannot be deleted.\n"
end
- it 'knife delete /containers/x.json succeeds' do
- knife('delete /containers/x.json').should_succeed "Deleted /containers/x.json\n"
- knife('raw /containers/x.json').should_fail(/404/)
+ it "knife delete /containers/x.json succeeds" do
+ knife("delete /containers/x.json").should_succeed "Deleted /containers/x.json\n"
+ knife("raw /containers/x.json").should_fail(/404/)
end
- it 'knife delete /groups/x.json succeeds' do
- knife('delete /groups/x.json').should_succeed "Deleted /groups/x.json\n"
- knife('raw /groups/x.json').should_fail(/404/)
+ it "knife delete /groups/x.json succeeds" do
+ knife("delete /groups/x.json").should_succeed "Deleted /groups/x.json\n"
+ knife("raw /groups/x.json").should_fail(/404/)
end
- it 'knife delete /policies/x-1.2.3.json succeeds' do
- knife('raw /policies/x/revisions/1.2.3').should_succeed "{\n \"name\": \"x\",\n \"revision_id\": \"1.2.3\",\n \"run_list\": [\n\n ],\n \"cookbook_locks\": {\n\n }\n}\n"
- knife('delete /policies/x-1.2.3.json').should_succeed "Deleted /policies/x-1.2.3.json\n"
- knife('raw /policies/x/revisions/1.2.3').should_fail(/404/)
+ it "knife delete /policies/x-1.2.3.json succeeds" do
+ knife("raw /policies/x/revisions/1.2.3").should_succeed "{\n \"name\": \"x\",\n \"revision_id\": \"1.2.3\",\n \"run_list\": [\n\n ],\n \"cookbook_locks\": {\n\n }\n}\n"
+ knife("delete /policies/x-1.2.3.json").should_succeed "Deleted /policies/x-1.2.3.json\n"
+ knife("raw /policies/x/revisions/1.2.3").should_fail(/404/)
end
- it 'knife delete /policy_groups/x.json succeeds' do
- knife('raw /policy_groups/x').should_succeed "{\n \"uri\": \"http://127.0.0.1:8900/organizations/foo/policy_groups/x\",\n \"policies\": {\n \"x\": {\n \"revision_id\": \"1.2.3\"\n }\n }\n}\n"
- knife('delete /policy_groups/x.json').should_succeed "Deleted /policy_groups/x.json\n"
- knife('raw /policy_groups/x').should_fail(/404/)
+ it "knife delete /policy_groups/x.json succeeds" do
+ knife("raw /policy_groups/x").should_succeed "{\n \"uri\": \"http://127.0.0.1:8900/organizations/foo/policy_groups/x\",\n \"policies\": {\n \"x\": {\n \"revision_id\": \"1.2.3\"\n }\n }\n}\n"
+ knife("delete /policy_groups/x.json").should_succeed "Deleted /policy_groups/x.json\n"
+ knife("raw /policy_groups/x").should_fail(/404/)
end
- it 'knife delete /org.json fails with a reasonable error' do
- knife('delete /org.json').should_fail "ERROR: /org.json (remote) cannot be deleted.\n"
+ it "knife delete /org.json fails with a reasonable error" do
+ knife("delete /org.json").should_fail "ERROR: /org.json (remote) cannot be deleted.\n"
end
- it 'knife delete /invitations.json fails with a reasonable error' do
- knife('delete /invitations.json').should_fail "ERROR: /invitations.json (remote) cannot be deleted.\n"
+ it "knife delete /invitations.json fails with a reasonable error" do
+ knife("delete /invitations.json").should_fail "ERROR: /invitations.json (remote) cannot be deleted.\n"
end
- it 'knife delete /members.json fails with a reasonable error' do
- knife('delete /members.json').should_fail "ERROR: /members.json (remote) cannot be deleted.\n"
+ it "knife delete /members.json fails with a reasonable error" do
+ knife("delete /members.json").should_fail "ERROR: /members.json (remote) cannot be deleted.\n"
end
end
end
diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb
index 6861913d59..8348c601aa 100644
--- a/spec/integration/knife/deps_spec.rb
+++ b/spec/integration/knife/deps_spec.rb
@@ -15,33 +15,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/deps'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/deps"
-describe 'knife deps', :workstation do
+describe "knife deps", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'local' do
- when_the_repository 'has a role with no run_list' do
- before { file 'roles/starring.json', {} }
- it 'knife deps reports no dependencies' do
- knife('deps /roles/starring.json').should_succeed "/roles/starring.json\n"
+ context "local" do
+ when_the_repository "has a role with no run_list" do
+ before { file "roles/starring.json", {} }
+ it "knife deps reports no dependencies" do
+ knife("deps /roles/starring.json").should_succeed "/roles/starring.json\n"
end
end
- when_the_repository 'has a role with a default run_list' do
+ when_the_repository "has a role with a default run_list" do
before do
- file 'roles/starring.json', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- end
- it 'knife deps reports all dependencies' do
- knife('deps /roles/starring.json').should_succeed <<EOM
+ file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ end
+ it "knife deps reports all dependencies" do
+ knife("deps /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -50,17 +50,17 @@ EOM
end
end
- when_the_repository 'has a role with an env_run_list' do
+ when_the_repository "has a role with an env_run_list" do
before do
- file 'roles/starring.json', { 'env_run_lists' => { 'desert' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- end
- it 'knife deps reports all dependencies' do
- knife('deps /roles/starring.json').should_succeed <<EOM
+ file "roles/starring.json", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ end
+ it "knife deps reports all dependencies" do
+ knife("deps /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -69,32 +69,32 @@ EOM
end
end
- when_the_repository 'has a node with no environment or run_list' do
- before { file 'nodes/mort.json', {} }
- it 'knife deps reports just the node' do
- knife('deps /nodes/mort.json').should_succeed "/nodes/mort.json\n"
+ when_the_repository "has a node with no environment or run_list" do
+ before { file "nodes/mort.json", {} }
+ it "knife deps reports just the node" do
+ knife("deps /nodes/mort.json").should_succeed "/nodes/mort.json\n"
end
end
- when_the_repository 'has a node with an environment' do
+ when_the_repository "has a node with an environment" do
before do
- file 'environments/desert.json', {}
- file 'nodes/mort.json', { 'chef_environment' => 'desert' }
+ file "environments/desert.json", {}
+ file "nodes/mort.json", { "chef_environment" => "desert" }
end
- it 'knife deps reports just the node' do
- knife('deps /nodes/mort.json').should_succeed "/environments/desert.json\n/nodes/mort.json\n"
+ it "knife deps reports just the node" do
+ knife("deps /nodes/mort.json").should_succeed "/environments/desert.json\n/nodes/mort.json\n"
end
end
- when_the_repository 'has a node with roles and recipes in its run_list' do
+ when_the_repository "has a node with roles and recipes in its run_list" do
before do
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- file 'nodes/mort.json', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- end
- it 'knife deps reports just the node' do
- knife('deps /nodes/mort.json').should_succeed <<EOM
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ file "nodes/mort.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ end
+ it "knife deps reports just the node" do
+ knife("deps /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -102,53 +102,53 @@ EOM
EOM
end
end
- when_the_repository 'has a cookbook with no dependencies' do
+ when_the_repository "has a cookbook with no dependencies" do
before do
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
end
- it 'knife deps reports just the cookbook' do
- knife('deps /cookbooks/quiche').should_succeed "/cookbooks/quiche\n"
+ it "knife deps reports just the cookbook" do
+ knife("deps /cookbooks/quiche").should_succeed "/cookbooks/quiche\n"
end
end
- when_the_repository 'has a cookbook with dependencies' do
+ when_the_repository "has a cookbook with dependencies" do
before do
- file 'cookbooks/kettle/metadata.rb', 'name "kettle"'
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"
+ file "cookbooks/kettle/metadata.rb", 'name "kettle"'
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"
depends "kettle"'
- file 'cookbooks/quiche/recipes/default.rb', ''
+ file "cookbooks/quiche/recipes/default.rb", ""
end
- it 'knife deps reports just the cookbook' do
- knife('deps /cookbooks/quiche').should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
+ it "knife deps reports just the cookbook" do
+ knife("deps /cookbooks/quiche").should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
end
end
- when_the_repository 'has a data bag' do
- before { file 'data_bags/bag/item.json', {} }
- it 'knife deps reports just the data bag' do
- knife('deps /data_bags/bag/item.json').should_succeed "/data_bags/bag/item.json\n"
+ when_the_repository "has a data bag" do
+ before { file "data_bags/bag/item.json", {} }
+ it "knife deps reports just the data bag" do
+ knife("deps /data_bags/bag/item.json").should_succeed "/data_bags/bag/item.json\n"
end
end
- when_the_repository 'has an environment' do
- before { file 'environments/desert.json', {} }
- it 'knife deps reports just the environment' do
- knife('deps /environments/desert.json').should_succeed "/environments/desert.json\n"
+ when_the_repository "has an environment" do
+ before { file "environments/desert.json", {} }
+ it "knife deps reports just the environment" do
+ knife("deps /environments/desert.json").should_succeed "/environments/desert.json\n"
end
end
- when_the_repository 'has a deep dependency tree' do
+ when_the_repository "has a deep dependency tree" do
before do
- file 'roles/starring.json', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- file 'environments/desert.json', {}
- file 'nodes/mort.json', { 'chef_environment' => 'desert', 'run_list' => [ 'role[starring]' ] }
- file 'nodes/bart.json', { 'run_list' => [ 'role[minor]' ] }
+ file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ file "environments/desert.json", {}
+ file "nodes/mort.json", { "chef_environment" => "desert", "run_list" => [ "role[starring]" ] }
+ file "nodes/bart.json", { "run_list" => [ "role[minor]" ] }
end
- it 'knife deps reports all dependencies' do
- knife('deps /nodes/mort.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps /nodes/mort.json").should_succeed <<EOM
/environments/desert.json
/roles/minor.json
/cookbooks/quiche
@@ -157,8 +157,8 @@ depends "kettle"'
/nodes/mort.json
EOM
end
- it 'knife deps * reports all dependencies of all things' do
- knife('deps /nodes/*').should_succeed <<EOM
+ it "knife deps * reports all dependencies of all things" do
+ knife("deps /nodes/*").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -168,8 +168,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps a b reports all dependencies of a and b' do
- knife('deps /nodes/bart.json /nodes/mort.json').should_succeed <<EOM
+ it "knife deps a b reports all dependencies of a and b" do
+ knife("deps /nodes/bart.json /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -179,8 +179,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps --tree /* shows dependencies in a tree' do
- knife('deps --tree /nodes/*').should_succeed <<EOM
+ it "knife deps --tree /* shows dependencies in a tree" do
+ knife("deps --tree /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -191,8 +191,8 @@ EOM
/cookbooks/soup
EOM
end
- it 'knife deps --tree --no-recurse shows only the first level of dependencies' do
- knife('deps --tree --no-recurse /nodes/*').should_succeed <<EOM
+ it "knife deps --tree --no-recurse shows only the first level of dependencies" do
+ knife("deps --tree --no-recurse /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -202,49 +202,49 @@ EOM
end
end
- context 'circular dependencies' do
- when_the_repository 'has cookbooks with circular dependencies' do
+ context "circular dependencies" do
+ when_the_repository "has cookbooks with circular dependencies" do
before do
- file 'cookbooks/foo/metadata.rb', 'name "foo"
+ file "cookbooks/foo/metadata.rb", 'name "foo"
depends "bar"'
- file 'cookbooks/bar/metadata.rb', 'name "bar"
+ file "cookbooks/bar/metadata.rb", 'name "bar"
depends "baz"'
- file 'cookbooks/baz/metadata.rb', 'name "baz"
+ file "cookbooks/baz/metadata.rb", 'name "baz"
depends "foo"'
- file 'cookbooks/self/metadata.rb', 'name "self"
+ file "cookbooks/self/metadata.rb", 'name "self"
depends "self"'
end
- it 'knife deps prints each once' do
- knife('deps /cookbooks/foo /cookbooks/self').should_succeed(
+ it "knife deps prints each once" do
+ knife("deps /cookbooks/foo /cookbooks/self").should_succeed(
stdout: "/cookbooks/baz\n/cookbooks/bar\n/cookbooks/foo\n/cookbooks/self\n",
stderr: "WARN: Ignoring self-dependency in cookbook self, please remove it (in the future this will be fatal).\n",
)
end
- it 'knife deps --tree prints each once' do
- knife('deps --tree /cookbooks/foo /cookbooks/self').should_succeed(
+ it "knife deps --tree prints each once" do
+ knife("deps --tree /cookbooks/foo /cookbooks/self").should_succeed(
stdout: "/cookbooks/foo\n /cookbooks/bar\n /cookbooks/baz\n /cookbooks/foo\n/cookbooks/self\n",
stderr: "WARN: Ignoring self-dependency in cookbook self, please remove it (in the future this will be fatal).\n",
)
end
end
- when_the_repository 'has roles with circular dependencies' do
+ when_the_repository "has roles with circular dependencies" do
before do
- file 'roles/foo.json', { 'run_list' => [ 'role[bar]' ] }
- file 'roles/bar.json', { 'run_list' => [ 'role[baz]' ] }
- file 'roles/baz.json', { 'run_list' => [ 'role[foo]' ] }
- file 'roles/self.json', { 'run_list' => [ 'role[self]' ] }
+ file "roles/foo.json", { "run_list" => [ "role[bar]" ] }
+ file "roles/bar.json", { "run_list" => [ "role[baz]" ] }
+ file "roles/baz.json", { "run_list" => [ "role[foo]" ] }
+ file "roles/self.json", { "run_list" => [ "role[self]" ] }
end
- it 'knife deps prints each once' do
- knife('deps /roles/foo.json /roles/self.json').should_succeed <<EOM
+ it "knife deps prints each once" do
+ knife("deps /roles/foo.json /roles/self.json").should_succeed <<EOM
/roles/baz.json
/roles/bar.json
/roles/foo.json
/roles/self.json
EOM
end
- it 'knife deps --tree prints each once' do
- knife('deps --tree /roles/foo.json /roles/self.json') do
+ it "knife deps --tree prints each once" do
+ knife("deps --tree /roles/foo.json /roles/self.json") do
expect(stdout).to eq("/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n")
expect(stderr).to eq("WARNING: No knife configuration file found\n")
end
@@ -252,81 +252,81 @@ EOM
end
end
- context 'missing objects' do
- when_the_repository 'is empty' do
- it 'knife deps /blah reports an error' do
- knife('deps /blah').should_fail(
+ context "missing objects" do
+ when_the_repository "is empty" do
+ it "knife deps /blah reports an error" do
+ knife("deps /blah").should_fail(
:exit_code => 2,
:stdout => "/blah\n",
:stderr => "ERROR: /blah: No such file or directory\n",
)
end
- it 'knife deps /roles/x.json reports an error' do
- knife('deps /roles/x.json').should_fail(
+ it "knife deps /roles/x.json reports an error" do
+ knife("deps /roles/x.json").should_fail(
:exit_code => 2,
:stdout => "/roles/x.json\n",
:stderr => "ERROR: /roles/x.json: No such file or directory\n",
)
end
- it 'knife deps /nodes/x.json reports an error' do
- knife('deps /nodes/x.json').should_fail(
+ it "knife deps /nodes/x.json reports an error" do
+ knife("deps /nodes/x.json").should_fail(
:exit_code => 2,
:stdout => "/nodes/x.json\n",
:stderr => "ERROR: /nodes/x.json: No such file or directory\n",
)
end
- it 'knife deps /environments/x.json reports an error' do
- knife('deps /environments/x.json').should_fail(
+ it "knife deps /environments/x.json reports an error" do
+ knife("deps /environments/x.json").should_fail(
:exit_code => 2,
:stdout => "/environments/x.json\n",
:stderr => "ERROR: /environments/x.json: No such file or directory\n",
)
end
- it 'knife deps /cookbooks/x reports an error' do
- knife('deps /cookbooks/x').should_fail(
+ it "knife deps /cookbooks/x reports an error" do
+ knife("deps /cookbooks/x").should_fail(
:exit_code => 2,
:stdout => "/cookbooks/x\n",
:stderr => "ERROR: /cookbooks/x: No such file or directory\n",
)
end
- it 'knife deps /data_bags/bag/item reports an error' do
- knife('deps /data_bags/bag/item').should_fail(
+ it "knife deps /data_bags/bag/item reports an error" do
+ knife("deps /data_bags/bag/item").should_fail(
:exit_code => 2,
:stdout => "/data_bags/bag/item\n",
:stderr => "ERROR: /data_bags/bag/item: No such file or directory\n",
)
end
end
- when_the_repository 'is missing a dependent cookbook' do
+ when_the_repository "is missing a dependent cookbook" do
before do
- file 'roles/starring.json', { 'run_list' => [ 'recipe[quiche]'] }
+ file "roles/starring.json", { "run_list" => [ "recipe[quiche]"] }
end
- it 'knife deps reports the cookbook, along with an error' do
- knife('deps /roles/starring.json').should_fail(
+ it "knife deps reports the cookbook, along with an error" do
+ knife("deps /roles/starring.json").should_fail(
:exit_code => 2,
:stdout => "/cookbooks/quiche\n/roles/starring.json\n",
:stderr => "ERROR: /cookbooks/quiche: No such file or directory\n",
)
end
end
- when_the_repository 'is missing a dependent environment' do
+ when_the_repository "is missing a dependent environment" do
before do
- file 'nodes/mort.json', { 'chef_environment' => 'desert' }
+ file "nodes/mort.json", { "chef_environment" => "desert" }
end
- it 'knife deps reports the environment, along with an error' do
- knife('deps /nodes/mort.json').should_fail(
+ it "knife deps reports the environment, along with an error" do
+ knife("deps /nodes/mort.json").should_fail(
:exit_code => 2,
:stdout => "/environments/desert.json\n/nodes/mort.json\n",
:stderr => "ERROR: /environments/desert.json: No such file or directory\n",
)
end
end
- when_the_repository 'is missing a dependent role' do
+ when_the_repository "is missing a dependent role" do
before do
- file 'roles/starring.json', { 'run_list' => [ 'role[minor]'] }
+ file "roles/starring.json", { "run_list" => [ "role[minor]"] }
end
- it 'knife deps reports the role, along with an error' do
- knife('deps /roles/starring.json').should_fail(
+ it "knife deps reports the role, along with an error" do
+ knife("deps /roles/starring.json").should_fail(
:exit_code => 2,
:stdout => "/roles/minor.json\n/roles/starring.json\n",
:stderr => "ERROR: /roles/minor.json: No such file or directory\n",
@@ -334,29 +334,29 @@ EOM
end
end
end
- context 'invalid objects' do
- when_the_repository 'is empty' do
- it 'knife deps / reports itself only' do
- knife('deps /').should_succeed("/\n")
+ context "invalid objects" do
+ when_the_repository "is empty" do
+ it "knife deps / reports itself only" do
+ knife("deps /").should_succeed("/\n")
end
- it 'knife deps /roles reports an error' do
- knife('deps /roles').should_fail(
+ it "knife deps /roles reports an error" do
+ knife("deps /roles").should_fail(
:exit_code => 2,
:stderr => "ERROR: /roles: No such file or directory\n",
:stdout => "/roles\n",
)
end
end
- when_the_repository 'has a data bag' do
- before { file 'data_bags/bag/item.json', '' }
- it 'knife deps /data_bags/bag shows no dependencies' do
- knife('deps /data_bags/bag').should_succeed("/data_bags/bag\n")
+ when_the_repository "has a data bag" do
+ before { file "data_bags/bag/item.json", "" }
+ it "knife deps /data_bags/bag shows no dependencies" do
+ knife("deps /data_bags/bag").should_succeed("/data_bags/bag\n")
end
end
- when_the_repository 'has a cookbook' do
- before { file 'cookbooks/blah/metadata.rb', 'name "blah"' }
- it 'knife deps on a cookbook file shows no dependencies' do
- knife('deps /cookbooks/blah/metadata.rb').should_succeed(
+ when_the_repository "has a cookbook" do
+ before { file "cookbooks/blah/metadata.rb", 'name "blah"' }
+ it "knife deps on a cookbook file shows no dependencies" do
+ knife("deps /cookbooks/blah/metadata.rb").should_succeed(
"/cookbooks/blah/metadata.rb\n"
)
end
@@ -364,25 +364,25 @@ EOM
end
end
- context 'remote' do
+ context "remote" do
include_context "default config options"
- when_the_chef_server 'has a role with no run_list' do
- before { role 'starring', {} }
- it 'knife deps reports no dependencies' do
- knife('deps --remote /roles/starring.json').should_succeed "/roles/starring.json\n"
+ when_the_chef_server "has a role with no run_list" do
+ before { role "starring", {} }
+ it "knife deps reports no dependencies" do
+ knife("deps --remote /roles/starring.json").should_succeed "/roles/starring.json\n"
end
end
- when_the_chef_server 'has a role with a default run_list' do
+ when_the_chef_server "has a role with a default run_list" do
before do
- role 'starring', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
+ role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
end
- it 'knife deps reports all dependencies' do
- knife('deps --remote /roles/starring.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps --remote /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -391,15 +391,15 @@ EOM
end
end
- when_the_chef_server 'has a role with an env_run_list' do
+ when_the_chef_server "has a role with an env_run_list" do
before do
- role 'starring', { 'env_run_lists' => { 'desert' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
+ role "starring", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
end
- it 'knife deps reports all dependencies' do
- knife('deps --remote /roles/starring.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps --remote /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -408,30 +408,30 @@ EOM
end
end
- when_the_chef_server 'has a node with no environment or run_list' do
- before { node 'mort', {} }
- it 'knife deps reports just the node' do
- knife('deps --remote /nodes/mort.json').should_succeed "/nodes/mort.json\n"
+ when_the_chef_server "has a node with no environment or run_list" do
+ before { node "mort", {} }
+ it "knife deps reports just the node" do
+ knife("deps --remote /nodes/mort.json").should_succeed "/nodes/mort.json\n"
end
end
- when_the_chef_server 'has a node with an environment' do
+ when_the_chef_server "has a node with an environment" do
before do
- environment 'desert', {}
- node 'mort', { 'chef_environment' => 'desert' }
+ environment "desert", {}
+ node "mort", { "chef_environment" => "desert" }
end
- it 'knife deps reports just the node' do
- knife('deps --remote /nodes/mort.json').should_succeed "/environments/desert.json\n/nodes/mort.json\n"
+ it "knife deps reports just the node" do
+ knife("deps --remote /nodes/mort.json").should_succeed "/environments/desert.json\n/nodes/mort.json\n"
end
end
- when_the_chef_server 'has a node with roles and recipes in its run_list' do
+ when_the_chef_server "has a node with roles and recipes in its run_list" do
before do
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
- node 'mort', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
+ node "mort", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
end
- it 'knife deps reports just the node' do
- knife('deps --remote /nodes/mort.json').should_succeed <<EOM
+ it "knife deps reports just the node" do
+ knife("deps --remote /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -439,49 +439,49 @@ EOM
EOM
end
end
- when_the_chef_server 'has a cookbook with no dependencies' do
+ when_the_chef_server "has a cookbook with no dependencies" do
before do
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
end
- it 'knife deps reports just the cookbook' do
- knife('deps --remote /cookbooks/quiche').should_succeed "/cookbooks/quiche\n"
+ it "knife deps reports just the cookbook" do
+ knife("deps --remote /cookbooks/quiche").should_succeed "/cookbooks/quiche\n"
end
end
- when_the_chef_server 'has a cookbook with dependencies' do
+ when_the_chef_server "has a cookbook with dependencies" do
before do
- cookbook 'kettle', '1.0.0', { 'metadata.rb' => %Q{name "kettle"\nversion "1.0.0"\n} }
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => 'name "quiche"
-depends "kettle"', 'recipes' => { 'default.rb' => '' } }
+ cookbook "kettle", "1.0.0", { "metadata.rb" => %Q{name "kettle"\nversion "1.0.0"\n} }
+ cookbook "quiche", "1.0.0", { "metadata.rb" => 'name "quiche"
+depends "kettle"', "recipes" => { "default.rb" => "" } }
end
- it 'knife deps reports the cookbook and its dependencies' do
- knife('deps --remote /cookbooks/quiche').should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
+ it "knife deps reports the cookbook and its dependencies" do
+ knife("deps --remote /cookbooks/quiche").should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
end
end
- when_the_chef_server 'has a data bag' do
- before { data_bag 'bag', { 'item' => {} } }
- it 'knife deps reports just the data bag' do
- knife('deps --remote /data_bags/bag/item.json').should_succeed "/data_bags/bag/item.json\n"
+ when_the_chef_server "has a data bag" do
+ before { data_bag "bag", { "item" => {} } }
+ it "knife deps reports just the data bag" do
+ knife("deps --remote /data_bags/bag/item.json").should_succeed "/data_bags/bag/item.json\n"
end
end
- when_the_chef_server 'has an environment' do
- before { environment 'desert', {} }
- it 'knife deps reports just the environment' do
- knife('deps --remote /environments/desert.json').should_succeed "/environments/desert.json\n"
+ when_the_chef_server "has an environment" do
+ before { environment "desert", {} }
+ it "knife deps reports just the environment" do
+ knife("deps --remote /environments/desert.json").should_succeed "/environments/desert.json\n"
end
end
- when_the_chef_server 'has a deep dependency tree' do
+ when_the_chef_server "has a deep dependency tree" do
before do
- role 'starring', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
- environment 'desert', {}
- node 'mort', { 'chef_environment' => 'desert', 'run_list' => [ 'role[starring]' ] }
- node 'bart', { 'run_list' => [ 'role[minor]' ] }
+ role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
+ environment "desert", {}
+ node "mort", { "chef_environment" => "desert", "run_list" => [ "role[starring]" ] }
+ node "bart", { "run_list" => [ "role[minor]" ] }
end
- it 'knife deps reports all dependencies' do
- knife('deps --remote /nodes/mort.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps --remote /nodes/mort.json").should_succeed <<EOM
/environments/desert.json
/roles/minor.json
/cookbooks/quiche
@@ -490,8 +490,8 @@ depends "kettle"', 'recipes' => { 'default.rb' => '' } }
/nodes/mort.json
EOM
end
- it 'knife deps * reports all dependencies of all things' do
- knife('deps --remote /nodes/*').should_succeed <<EOM
+ it "knife deps * reports all dependencies of all things" do
+ knife("deps --remote /nodes/*").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -501,8 +501,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps a b reports all dependencies of a and b' do
- knife('deps --remote /nodes/bart.json /nodes/mort.json').should_succeed <<EOM
+ it "knife deps a b reports all dependencies of a and b" do
+ knife("deps --remote /nodes/bart.json /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -512,8 +512,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps --tree /* shows dependencies in a tree' do
- knife('deps --remote --tree /nodes/*').should_succeed <<EOM
+ it "knife deps --tree /* shows dependencies in a tree" do
+ knife("deps --remote --tree /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -524,8 +524,8 @@ EOM
/cookbooks/soup
EOM
end
- it 'knife deps --tree --no-recurse shows only the first level of dependencies' do
- knife('deps --remote --tree --no-recurse /nodes/*').should_succeed <<EOM
+ it "knife deps --tree --no-recurse shows only the first level of dependencies" do
+ knife("deps --remote --tree --no-recurse /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -535,28 +535,28 @@ EOM
end
end
- context 'circular dependencies' do
- when_the_chef_server 'has cookbooks with circular dependencies' do
+ context "circular dependencies" do
+ when_the_chef_server "has cookbooks with circular dependencies" do
before do
- cookbook 'foo', '1.0.0', { 'metadata.rb' => 'name "foo"
+ cookbook "foo", "1.0.0", { "metadata.rb" => 'name "foo"
depends "bar"' }
- cookbook 'bar', '1.0.0', { 'metadata.rb' => 'name "bar"
+ cookbook "bar", "1.0.0", { "metadata.rb" => 'name "bar"
depends "baz"' }
- cookbook 'baz', '1.0.0', { 'metadata.rb' => 'name "baz"
+ cookbook "baz", "1.0.0", { "metadata.rb" => 'name "baz"
depends "foo"' }
- cookbook 'self', '1.0.0', { 'metadata.rb' => 'name "self"
+ cookbook "self", "1.0.0", { "metadata.rb" => 'name "self"
depends "self"' }
end
- it 'knife deps prints each once' do
- knife('deps --remote /cookbooks/foo /cookbooks/self').should_succeed <<EOM
+ it "knife deps prints each once" do
+ knife("deps --remote /cookbooks/foo /cookbooks/self").should_succeed <<EOM
/cookbooks/baz
/cookbooks/bar
/cookbooks/foo
/cookbooks/self
EOM
end
- it 'knife deps --tree prints each once' do
- knife('deps --remote --tree /cookbooks/foo /cookbooks/self').should_succeed <<EOM
+ it "knife deps --tree prints each once" do
+ knife("deps --remote --tree /cookbooks/foo /cookbooks/self").should_succeed <<EOM
/cookbooks/foo
/cookbooks/bar
/cookbooks/baz
@@ -566,23 +566,23 @@ EOM
EOM
end
end
- when_the_chef_server 'has roles with circular dependencies' do
+ when_the_chef_server "has roles with circular dependencies" do
before do
- role 'foo', { 'run_list' => [ 'role[bar]' ] }
- role 'bar', { 'run_list' => [ 'role[baz]' ] }
- role 'baz', { 'run_list' => [ 'role[foo]' ] }
- role 'self', { 'run_list' => [ 'role[self]' ] }
+ role "foo", { "run_list" => [ "role[bar]" ] }
+ role "bar", { "run_list" => [ "role[baz]" ] }
+ role "baz", { "run_list" => [ "role[foo]" ] }
+ role "self", { "run_list" => [ "role[self]" ] }
end
- it 'knife deps prints each once' do
- knife('deps --remote /roles/foo.json /roles/self.json').should_succeed <<EOM
+ it "knife deps prints each once" do
+ knife("deps --remote /roles/foo.json /roles/self.json").should_succeed <<EOM
/roles/baz.json
/roles/bar.json
/roles/foo.json
/roles/self.json
EOM
end
- it 'knife deps --tree prints each once' do
- knife('deps --remote --tree /roles/foo.json /roles/self.json') do
+ it "knife deps --tree prints each once" do
+ knife("deps --remote --tree /roles/foo.json /roles/self.json") do
expect(stdout).to eq("/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n")
expect(stderr).to eq("WARNING: No knife configuration file found\n")
end
@@ -590,81 +590,81 @@ EOM
end
end
- context 'missing objects' do
- when_the_chef_server 'is empty' do
- it 'knife deps /blah reports an error' do
- knife('deps --remote /blah').should_fail(
+ context "missing objects" do
+ when_the_chef_server "is empty" do
+ it "knife deps /blah reports an error" do
+ knife("deps --remote /blah").should_fail(
:exit_code => 2,
:stdout => "/blah\n",
:stderr => "ERROR: /blah: No such file or directory\n",
)
end
- it 'knife deps /roles/x.json reports an error' do
- knife('deps --remote /roles/x.json').should_fail(
+ it "knife deps /roles/x.json reports an error" do
+ knife("deps --remote /roles/x.json").should_fail(
:exit_code => 2,
:stdout => "/roles/x.json\n",
:stderr => "ERROR: /roles/x.json: No such file or directory\n",
)
end
- it 'knife deps /nodes/x.json reports an error' do
- knife('deps --remote /nodes/x.json').should_fail(
+ it "knife deps /nodes/x.json reports an error" do
+ knife("deps --remote /nodes/x.json").should_fail(
:exit_code => 2,
:stdout => "/nodes/x.json\n",
:stderr => "ERROR: /nodes/x.json: No such file or directory\n",
)
end
- it 'knife deps /environments/x.json reports an error' do
- knife('deps --remote /environments/x.json').should_fail(
+ it "knife deps /environments/x.json reports an error" do
+ knife("deps --remote /environments/x.json").should_fail(
:exit_code => 2,
:stdout => "/environments/x.json\n",
:stderr => "ERROR: /environments/x.json: No such file or directory\n",
)
end
- it 'knife deps /cookbooks/x reports an error' do
- knife('deps --remote /cookbooks/x').should_fail(
+ it "knife deps /cookbooks/x reports an error" do
+ knife("deps --remote /cookbooks/x").should_fail(
:exit_code => 2,
:stdout => "/cookbooks/x\n",
:stderr => "ERROR: /cookbooks/x: No such file or directory\n",
)
end
- it 'knife deps /data_bags/bag/item reports an error' do
- knife('deps --remote /data_bags/bag/item').should_fail(
+ it "knife deps /data_bags/bag/item reports an error" do
+ knife("deps --remote /data_bags/bag/item").should_fail(
:exit_code => 2,
:stdout => "/data_bags/bag/item\n",
:stderr => "ERROR: /data_bags/bag/item: No such file or directory\n",
)
end
end
- when_the_chef_server 'is missing a dependent cookbook' do
+ when_the_chef_server "is missing a dependent cookbook" do
before do
- role 'starring', { 'run_list' => [ 'recipe[quiche]'] }
+ role "starring", { "run_list" => [ "recipe[quiche]"] }
end
- it 'knife deps reports the cookbook, along with an error' do
- knife('deps --remote /roles/starring.json').should_fail(
+ it "knife deps reports the cookbook, along with an error" do
+ knife("deps --remote /roles/starring.json").should_fail(
:exit_code => 2,
:stdout => "/cookbooks/quiche\n/roles/starring.json\n",
:stderr => "ERROR: /cookbooks/quiche: No such file or directory\n",
)
end
end
- when_the_chef_server 'is missing a dependent environment' do
+ when_the_chef_server "is missing a dependent environment" do
before do
- node 'mort', { 'chef_environment' => 'desert' }
+ node "mort", { "chef_environment" => "desert" }
end
- it 'knife deps reports the environment, along with an error' do
- knife('deps --remote /nodes/mort.json').should_fail(
+ it "knife deps reports the environment, along with an error" do
+ knife("deps --remote /nodes/mort.json").should_fail(
:exit_code => 2,
:stdout => "/environments/desert.json\n/nodes/mort.json\n",
:stderr => "ERROR: /environments/desert.json: No such file or directory\n",
)
end
end
- when_the_chef_server 'is missing a dependent role' do
+ when_the_chef_server "is missing a dependent role" do
before do
- role 'starring', { 'run_list' => [ 'role[minor]'] }
+ role "starring", { "run_list" => [ "role[minor]"] }
end
- it 'knife deps reports the role, along with an error' do
- knife('deps --remote /roles/starring.json').should_fail(
+ it "knife deps reports the role, along with an error" do
+ knife("deps --remote /roles/starring.json").should_fail(
:exit_code => 2,
:stdout => "/roles/minor.json\n/roles/starring.json\n",
:stderr => "ERROR: /roles/minor.json: No such file or directory\n",
@@ -672,27 +672,27 @@ EOM
end
end
end
- context 'invalid objects' do
- when_the_chef_server 'is empty' do
- it 'knife deps / reports an error' do
- knife('deps --remote /').should_succeed("/\n")
+ context "invalid objects" do
+ when_the_chef_server "is empty" do
+ it "knife deps / reports an error" do
+ knife("deps --remote /").should_succeed("/\n")
end
- it 'knife deps /roles reports an error' do
- knife('deps --remote /roles').should_succeed("/roles\n")
+ it "knife deps /roles reports an error" do
+ knife("deps --remote /roles").should_succeed("/roles\n")
end
end
- when_the_chef_server 'has a data bag' do
- before { data_bag 'bag', { 'item' => {} } }
- it 'knife deps /data_bags/bag shows no dependencies' do
- knife('deps --remote /data_bags/bag').should_succeed("/data_bags/bag\n")
+ when_the_chef_server "has a data bag" do
+ before { data_bag "bag", { "item" => {} } }
+ it "knife deps /data_bags/bag shows no dependencies" do
+ knife("deps --remote /data_bags/bag").should_succeed("/data_bags/bag\n")
end
end
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'blah', '1.0.0', { 'metadata.rb' => 'name "blah"' }
+ cookbook "blah", "1.0.0", { "metadata.rb" => 'name "blah"' }
end
- it 'knife deps on a cookbook file shows no dependencies' do
- knife('deps --remote /cookbooks/blah/metadata.rb').should_succeed(
+ it "knife deps on a cookbook file shows no dependencies" do
+ knife("deps --remote /cookbooks/blah/metadata.rb").should_succeed(
"/cookbooks/blah/metadata.rb\n"
)
end
@@ -700,7 +700,7 @@ EOM
end
end
- it 'knife deps --no-recurse reports an error' do
- knife('deps --no-recurse /').should_fail("ERROR: --no-recurse requires --tree\n")
+ it "knife deps --no-recurse reports an error" do
+ knife("deps --no-recurse /").should_fail("ERROR: --no-recurse requires --tree\n")
end
end
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb
index b32a4580a1..822b07d9e1 100644
--- a/spec/integration/knife/diff_spec.rb
+++ b/spec/integration/knife/diff_spec.rb
@@ -15,38 +15,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/diff'
+require "support/shared/integration/integration_helper"
+require "chef/knife/diff"
-describe 'knife diff', :workstation do
+describe "knife diff", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'without versioned cookbooks' do
+ context "without versioned cookbooks" do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -62,65 +62,65 @@ EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife diff reports no differences' do
- knife('diff /').should_succeed ''
+ it "knife diff reports no differences" do
+ knife("diff /").should_succeed ""
end
- it 'knife diff /environments/nonexistent.json reports an error' do
- knife('diff /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
+ it "knife diff /environments/nonexistent.json reports an error" do
+ knife("diff /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
end
- it 'knife diff /environments/*.txt reports an error' do
- knife('diff /environments/*.txt').should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
+ it "knife diff /environments/*.txt reports an error" do
+ knife("diff /environments/*.txt").should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"foo": "bar"
}
EOM
end
- it 'knife diff reports the role as different' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the role as different" do
+ knife("diff --name-status /").should_succeed <<EOM
M\t/roles/x.json
EOM
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/blah.rb', ''
- file 'cookbooks/y/metadata.rb', cb_metadata("y", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/blah.rb", ""
+ file "cookbooks/y/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife diff reports the new files as added' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the new files as added" do
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x/blah.rb
A\t/cookbooks/y
@@ -133,16 +133,16 @@ A\t/users/y.json
EOM
end
- context 'when cwd is the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife diff reports different data bags' do
- knife('diff --name-status').should_succeed <<EOM
+ context "when cwd is the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife diff reports different data bags" do
+ knife("diff --name-status").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
end
- it 'knife diff * reports different data bags' do
- knife('diff --name-status *').should_succeed <<EOM
+ it "knife diff * reports different data bags" do
+ knife("diff --name-status *").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
@@ -151,9 +151,9 @@ EOM
end
end
- when_the_repository 'is empty' do
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -166,51 +166,51 @@ EOM
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x/onlyin1.0.0.rb', ''
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/onlyin1.0.0.rb", ""
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks/x shows differences' do
- knife('diff --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff /cookbooks/x shows differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
end
- it 'knife diff --diff-filter=MAT does not show deleted files' do
- knife('diff --diff-filter=MAT --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff --diff-filter=MAT does not show deleted files" do
+ knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks/x shows no differences' do
- knife('diff --name-status /cookbooks/x').should_succeed ''
+ it "knife diff /cookbooks/x shows no differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks/x shows the differences' do
- knife('diff --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff /cookbooks/x shows the differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -218,13 +218,13 @@ EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks/x shows the differences' do
- knife('diff --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff /cookbooks/x shows the differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin0.9.9.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -233,22 +233,22 @@ EOM
end
end
- context 'json diff tests' do
- when_the_repository 'has an empty environment file' do
+ context "json diff tests" do
+ when_the_repository "has an empty environment file" do
before do
- file 'environments/x.json', {}
+ file "environments/x.json", {}
end
- when_the_chef_server 'has an empty environment' do
- before { environment 'x', {} }
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ when_the_chef_server "has an empty environment" do
+ before { environment "x", {} }
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
end
- when_the_chef_server 'has an environment with a different value' do
- before { environment 'x', { 'description' => 'hi' } }
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ when_the_chef_server "has an environment with a different value" do
+ before { environment "x", { "description" => "hi" } }
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x",
- "description": "hi"
@@ -259,26 +259,26 @@ EOM
end
end
- when_the_repository 'has an environment file with a value in it' do
+ when_the_repository "has an environment file with a value in it" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- when_the_chef_server 'has an environment with the same value' do
+ when_the_chef_server "has an environment with the same value" do
before do
- environment 'x', { 'description' => 'hi' }
+ environment "x", { "description" => "hi" }
end
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
end
- when_the_chef_server 'has an environment with no value' do
+ when_the_chef_server "has an environment with no value" do
before do
- environment 'x', {}
+ environment "x", {}
end
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x"
\+ "name": "x",
@@ -287,12 +287,12 @@ EOM
/)
end
end
- when_the_chef_server 'has an environment with a different value' do
+ when_the_chef_server "has an environment with a different value" do
before do
- environment 'x', { 'description' => 'lo' }
+ environment "x", { "description" => "lo" }
end
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
"name": "x",
- "description": "lo"
@@ -304,14 +304,14 @@ EOM
end
end
- when_the_chef_server 'has an environment' do
- before { environment 'x', {} }
- when_the_repository 'has an environment with bad JSON' do
- before { file 'environments/x.json', '{' }
- it 'knife diff reports an error and does a textual diff' do
+ when_the_chef_server "has an environment" do
+ before { environment "x", {} }
+ when_the_repository "has an environment with bad JSON" do
+ before { file "environments/x.json", "{" }
+ it "knife diff reports an error and does a textual diff" do
error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF"
error_match = Regexp.new(Regexp.escape(error_text))
- knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr => error_match)
+ knife("diff /environments/x.json").should_succeed(/- "name": "x"/, :stderr => error_match)
end
end
end
@@ -320,28 +320,28 @@ EOM
with_versioned_cookbooks do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -357,65 +357,65 @@ EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife diff reports no differences' do
- knife('diff /').should_succeed ''
+ it "knife diff reports no differences" do
+ knife("diff /").should_succeed ""
end
- it 'knife diff /environments/nonexistent.json reports an error' do
- knife('diff /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
+ it "knife diff /environments/nonexistent.json reports an error" do
+ knife("diff /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
end
- it 'knife diff /environments/*.txt reports an error' do
- knife('diff /environments/*.txt').should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
+ it "knife diff /environments/*.txt reports an error" do
+ knife("diff /environments/*.txt").should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"foo": "bar"
}
EOM
end
- it 'knife diff reports the role as different' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the role as different" do
+ knife("diff --name-status /").should_succeed <<EOM
M\t/roles/x.json
EOM
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', {}
- file 'cookbooks/x-1.0.0/blah.rb', ''
- file 'cookbooks/x-2.0.0/metadata.rb', cb_metadata("x", "2.0.0")
- file 'cookbooks/y-1.0.0/metadata.rb', cb_metadata("y", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', {}
+ file "clients/y.json", {}
+ file "cookbooks/x-1.0.0/blah.rb", ""
+ file "cookbooks/x-2.0.0/metadata.rb", cb_metadata("x", "2.0.0")
+ file "cookbooks/y-1.0.0/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", {}
end
- it 'knife diff reports the new files as added' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the new files as added" do
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x-1.0.0/blah.rb
A\t/cookbooks/x-2.0.0
@@ -429,16 +429,16 @@ A\t/users/y.json
EOM
end
- context 'when cwd is the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife diff reports different data bags' do
- knife('diff --name-status').should_succeed <<EOM
+ context "when cwd is the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife diff reports different data bags" do
+ knife("diff --name-status").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
end
- it 'knife diff * reports different data bags' do
- knife('diff --name-status *').should_succeed <<EOM
+ it "knife diff * reports different data bags" do
+ knife("diff --name-status *").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
@@ -447,9 +447,9 @@ EOM
end
end
- when_the_repository 'is empty' do
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -462,59 +462,59 @@ EOM
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x-1.0.0/onlyin1.0.0.rb', ''
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/onlyin1.0.0.rb", ""
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks shows differences' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife diff /cookbooks shows differences" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.1
EOM
end
- it 'knife diff --diff-filter=MAT does not show deleted files' do
- knife('diff --diff-filter=MAT --name-status /cookbooks').should_succeed ''
+ it "knife diff --diff-filter=MAT does not show deleted files" do
+ knife("diff --diff-filter=MAT --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks shows the differences' do
- knife('diff --name-status /cookbooks').should_succeed "D\t/cookbooks/x-0.9.9\n"
+ it "knife diff /cookbooks shows the differences" do
+ knife("diff --name-status /cookbooks").should_succeed "D\t/cookbooks/x-0.9.9\n"
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks shows the differences' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife diff /cookbooks shows the differences" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.1
A\t/cookbooks/x-1.0.0
EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks shows the differences' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife diff /cookbooks shows the differences" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-0.9.9
A\t/cookbooks/x-1.0.0
EOM
@@ -522,19 +522,19 @@ EOM
end
end
- context 'json diff tests' do
- when_the_repository 'has an empty environment file' do
- before { file 'environments/x.json', {} }
- when_the_chef_server 'has an empty environment' do
- before { environment 'x', {} }
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ context "json diff tests" do
+ when_the_repository "has an empty environment file" do
+ before { file "environments/x.json", {} }
+ when_the_chef_server "has an empty environment" do
+ before { environment "x", {} }
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
end
- when_the_chef_server 'has an environment with a different value' do
- before { environment 'x', { 'description' => 'hi' } }
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ when_the_chef_server "has an environment with a different value" do
+ before { environment "x", { "description" => "hi" } }
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x",
- "description": "hi"
@@ -545,23 +545,23 @@ EOM
end
end
- when_the_repository 'has an environment file with a value in it' do
+ when_the_repository "has an environment file with a value in it" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- when_the_chef_server 'has an environment with the same value' do
+ when_the_chef_server "has an environment with the same value" do
before do
- environment 'x', { 'description' => 'hi' }
+ environment "x", { "description" => "hi" }
end
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
end
- when_the_chef_server 'has an environment with no value' do
- before { environment 'x', {} }
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ when_the_chef_server "has an environment with no value" do
+ before { environment "x", {} }
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x"
\+ "name": "x",
@@ -570,12 +570,12 @@ EOM
/)
end
end
- when_the_chef_server 'has an environment with a different value' do
+ when_the_chef_server "has an environment with a different value" do
before do
- environment 'x', { 'description' => 'lo' }
+ environment "x", { "description" => "lo" }
end
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
"name": "x",
- "description": "lo"
@@ -587,14 +587,14 @@ EOM
end
end
- when_the_chef_server 'has an environment' do
- before { environment 'x', {} }
- when_the_repository 'has an environment with bad JSON' do
- before { file 'environments/x.json', '{' }
- it 'knife diff reports an error and does a textual diff' do
+ when_the_chef_server "has an environment" do
+ before { environment "x", {} }
+ when_the_repository "has an environment with bad JSON" do
+ before { file "environments/x.json", "{" }
+ it "knife diff reports an error and does a textual diff" do
error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF"
error_match = Regexp.new(Regexp.escape(error_text))
- knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr => error_match)
+ knife("diff /environments/x.json").should_succeed(/- "name": "x"/, :stderr => error_match)
end
end
end
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index 24618ebcae..faa640f83b 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -15,40 +15,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/download'
-require 'chef/knife/diff'
+require "support/shared/integration/integration_helper"
+require "chef/knife/download"
+require "chef/knife/diff"
-describe 'knife download', :workstation do
+describe "knife download", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'without versioned cookbooks' do
+ context "without versioned cookbooks" do
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife download downloads everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download downloads everything" do
+ knife("download /").should_succeed <<EOM
Created /clients/chef-validator.json
Created /clients/chef-webui.json
Created /clients/x.json
@@ -63,38 +63,38 @@ Created /roles/x.json
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download makes no changes' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download makes no changes" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --purge makes no changes' do
- knife('download --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download --purge makes no changes" do
+ knife("download --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -113,20 +113,20 @@ EOM
EOM
end
- it 'knife download changes the role' do
- knife('download /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife download changes the role" do
+ knife("download /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --no-diff does not change the role' do
- knife('download --no-diff /').should_succeed ''
- knife('diff --name-status /').should_succeed "M\t/roles/x.json\n"
+ it "knife download --no-diff does not change the role" do
+ knife("download --no-diff /").should_succeed ""
+ knife("diff --name-status /").should_succeed "M\t/roles/x.json\n"
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -145,28 +145,28 @@ EOM
EOM
end
- it 'knife download / does not change anything' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download / does not change anything" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/blah.rb', ''
- file 'cookbooks/y/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/blah.rb", ""
+ file "cookbooks/y/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download does nothing' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife download does nothing" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x/blah.rb
A\t/cookbooks/y
@@ -179,8 +179,8 @@ A\t/users/y.json
EOM
end
- it 'knife download --purge deletes the extra files' do
- knife('download --purge /').should_succeed <<EOM
+ it "knife download --purge deletes the extra files" do
+ knife("download --purge /").should_succeed <<EOM
Deleted extra entry /clients/y.json (purge is on)
Deleted extra entry /cookbooks/x/blah.rb (purge is on)
Deleted extra entry /cookbooks/y (purge is on)
@@ -191,14 +191,14 @@ Deleted extra entry /nodes/y.json (purge is on)
Deleted extra entry /roles/y.json (purge is on)
Deleted extra entry /users/y.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife download creates the extra files' do
- knife('download /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife download creates the extra files" do
+ knife("download /").should_succeed <<EOM
Created /clients
Created /clients/chef-validator.json
Created /clients/chef-webui.json
@@ -220,11 +220,11 @@ Created /users
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --no-diff creates the extra files' do
- knife('download --no-diff /').should_succeed <<EOM
+ it "knife download --no-diff creates the extra files" do
+ knife("download --no-diff /").should_succeed <<EOM
Created /clients
Created /clients/chef-validator.json
Created /clients/chef-webui.json
@@ -246,41 +246,41 @@ Created /users
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife download with no parameters reports an error' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download with no parameters reports an error" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
end
end
end
# Test download of an item when the other end doesn't even have the container
- when_the_repository 'is empty' do
- when_the_chef_server 'has two data bag items' do
+ when_the_repository "is empty" do
+ when_the_chef_server "has two data bag items" do
before do
- data_bag 'x', { 'y' => {}, 'z' => {} }
+ data_bag "x", { "y" => {}, "z" => {} }
end
- it 'knife download of one data bag item itself succeeds' do
- knife('download /data_bags/x/y.json').should_succeed <<EOM
+ it "knife download of one data bag item itself succeeds" do
+ knife("download /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/z.json
EOM
end
- it 'knife download /data_bags/x /data_bags/x/y.json downloads x once' do
- knife('download /data_bags/x /data_bags/x/y.json').should_succeed <<EOM
+ it "knife download /data_bags/x /data_bags/x/y.json downloads x once" do
+ knife("download /data_bags/x /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags
Created /data_bags/x
Created /data_bags/x/y.json
@@ -290,285 +290,285 @@ EOM
end
end
- when_the_repository 'has three data bag items' do
+ when_the_repository "has three data bag items" do
before do
- file 'data_bags/x/deleted.json', <<EOM
+ file "data_bags/x/deleted.json", <<EOM
{
"id": "deleted"
}
EOM
- file 'data_bags/x/modified.json', <<EOM
+ file "data_bags/x/modified.json", <<EOM
{
"id": "modified"
}
EOM
- file 'data_bags/x/unmodified.json', <<EOM
+ file "data_bags/x/unmodified.json", <<EOM
{
"id": "unmodified"
}
EOM
end
- when_the_chef_server 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_chef_server "has a modified, unmodified, added and deleted data bag item" do
before do
- data_bag 'x', {
- 'added' => {},
- 'modified' => { 'foo' => 'bar' },
- 'unmodified' => {},
+ data_bag "x", {
+ "added" => {},
+ "modified" => { "foo" => "bar" },
+ "unmodified" => {},
}
end
- it 'knife download of the modified file succeeds' do
- knife('download /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife download of the modified file succeeds" do
+ knife("download /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the unmodified file does nothing' do
- knife('download /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the unmodified file does nothing" do
+ knife("download /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the added file succeeds' do
- knife('download /data_bags/x/added.json').should_succeed <<EOM
+ it "knife download of the added file succeeds" do
+ knife("download /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the deleted file does nothing' do
- knife('download /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the deleted file does nothing" do
+ knife("download /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the deleted file deletes it' do
- knife('download --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife download --purge of the deleted file deletes it" do
+ knife("download --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife download of the entire data bag downloads everything' do
- knife('download /data_bags/x').should_succeed <<EOM
+ it "knife download of the entire data bag downloads everything" do
+ knife("download /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the entire data bag downloads everything' do
- knife('download --purge /data_bags/x').should_succeed <<EOM
+ it "knife download --purge of the entire data bag downloads everything" do
+ knife("download --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife download fails' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download fails" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
- it 'knife download --purge . downloads everything' do
- knife('download --purge .').should_succeed <<EOM
+ it "knife download --purge . downloads everything" do
+ knife("download --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife download --purge * downloads everything' do
- knife('download --purge *').should_succeed <<EOM
+ it "knife download --purge * downloads everything" do
+ knife("download --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x/z.rb', ''
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/z.rb", ""
end
- when_the_chef_server 'has a modified, added and deleted file for the cookbook' do
+ when_the_chef_server "has a modified, added and deleted file for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'metadata.rb' => cb_metadata("x", "1.0.0", "#extra content"), 'y.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "metadata.rb" => cb_metadata("x", "1.0.0", "#extra content"), "y.rb" => "hi" }
end
- it 'knife download of a modified file succeeds' do
- knife('download /cookbooks/x/metadata.rb').should_succeed "Updated /cookbooks/x/metadata.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a modified file succeeds" do
+ knife("download /cookbooks/x/metadata.rb").should_succeed "Updated /cookbooks/x/metadata.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x/y.rb
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download of a deleted file does nothing' do
- knife('download /cookbooks/x/z.rb').should_succeed ''
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a deleted file does nothing" do
+ knife("download /cookbooks/x/z.rb").should_succeed ""
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/y.rb
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download --purge of a deleted file succeeds' do
- knife('download --purge /cookbooks/x/z.rb').should_succeed "Deleted extra entry /cookbooks/x/z.rb (purge is on)\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download --purge of a deleted file succeeds" do
+ knife("download --purge /cookbooks/x/z.rb").should_succeed "Deleted extra entry /cookbooks/x/z.rb (purge is on)\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/y.rb
EOM
end
- it 'knife download of an added file succeeds' do
- knife('download /cookbooks/x/y.rb').should_succeed "Created /cookbooks/x/y.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of an added file succeeds" do
+ knife("download /cookbooks/x/y.rb").should_succeed "Created /cookbooks/x/y.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download of the cookbook itself succeeds' do
- knife('download /cookbooks/x').should_succeed <<EOM
+ it "knife download of the cookbook itself succeeds" do
+ knife("download /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/y.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download --purge of the cookbook itself succeeds' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download --purge of the cookbook itself succeeds" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/y.rb
Deleted extra entry /cookbooks/x/z.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/onlyin1.0.1.rb
Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the updated file' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the updated file" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/onlyin1.0.0.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/onlyin1.0.1.rb
Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the old version' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the old version" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/onlyin0.9.9.rb
Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has an environment with bad JSON' do
+ when_the_repository "has an environment with bad JSON" do
before do
- file 'environments/x.json', '{'
+ file "environments/x.json", "{"
end
- it 'knife download succeeds' do
+ it "knife download succeeds" do
warning = <<-EOH
WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF
{
(right here) ------^
EOH
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr => warning
- knife('diff --name-status /environments/x.json').should_succeed ''
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n", :stderr => warning
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
@@ -577,28 +577,28 @@ EOH
with_versioned_cookbooks do
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife download downloads everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download downloads everything" do
+ knife("download /").should_succeed <<EOM
Created /clients/chef-validator.json
Created /clients/chef-webui.json
Created /clients/x.json
@@ -613,49 +613,49 @@ Created /roles/x.json
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download makes no changes' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download makes no changes" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --purge makes no changes' do
- knife('download --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download --purge makes no changes" do
+ knife("download --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', { "description" => "blarghle" }
+ file "roles/x.json", { "description" => "blarghle" }
end
- it 'knife download changes the role' do
- knife('download /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife download changes the role" do
+ knife("download /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role" ,
"default_attributes": {
@@ -674,29 +674,29 @@ EOM
EOM
end
- it 'knife download / does not change anything' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download / does not change anything" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/blah.rb', ''
- file 'cookbooks/x-2.0.0/metadata.rb', 'version "2.0.0"'
- file 'cookbooks/y-1.0.0/metadata.rb', 'version "1.0.0"'
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/blah.rb", ""
+ file "cookbooks/x-2.0.0/metadata.rb", 'version "2.0.0"'
+ file "cookbooks/y-1.0.0/metadata.rb", 'version "1.0.0"'
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download does nothing' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife download does nothing" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x-1.0.0/blah.rb
A\t/cookbooks/x-2.0.0
@@ -710,8 +710,8 @@ A\t/users/y.json
EOM
end
- it 'knife download --purge deletes the extra files' do
- knife('download --purge /').should_succeed <<EOM
+ it "knife download --purge deletes the extra files" do
+ knife("download --purge /").should_succeed <<EOM
Deleted extra entry /clients/y.json (purge is on)
Deleted extra entry /cookbooks/x-1.0.0/blah.rb (purge is on)
Deleted extra entry /cookbooks/x-2.0.0 (purge is on)
@@ -723,14 +723,14 @@ Deleted extra entry /nodes/y.json (purge is on)
Deleted extra entry /roles/y.json (purge is on)
Deleted extra entry /users/y.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife download creates the extra files' do
- knife('download /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife download creates the extra files" do
+ knife("download /").should_succeed <<EOM
Created /clients
Created /clients/chef-validator.json
Created /clients/chef-webui.json
@@ -752,324 +752,324 @@ Created /users
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife download with no parameters reports an error' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download with no parameters reports an error" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
end
end
end
# Test download of an item when the other end doesn't even have the container
- when_the_repository 'is empty' do
- when_the_chef_server 'has two data bag items' do
+ when_the_repository "is empty" do
+ when_the_chef_server "has two data bag items" do
before do
- data_bag 'x', { 'y' => {}, 'z' => {} }
+ data_bag "x", { "y" => {}, "z" => {} }
end
- it 'knife download of one data bag item itself succeeds' do
- knife('download /data_bags/x/y.json').should_succeed <<EOM
+ it "knife download of one data bag item itself succeeds" do
+ knife("download /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/z.json
EOM
end
end
end
- when_the_repository 'has three data bag items' do
+ when_the_repository "has three data bag items" do
before do
- file 'data_bags/x/deleted.json', <<EOM
+ file "data_bags/x/deleted.json", <<EOM
{
"id": "deleted"
}
EOM
- file 'data_bags/x/modified.json', <<EOM
+ file "data_bags/x/modified.json", <<EOM
{
"id": "modified"
}
EOM
- file 'data_bags/x/unmodified.json', <<EOM
+ file "data_bags/x/unmodified.json", <<EOM
{
"id": "unmodified"
}
EOM
end
- when_the_chef_server 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_chef_server "has a modified, unmodified, added and deleted data bag item" do
before do
- data_bag 'x', {
- 'added' => {},
- 'modified' => { 'foo' => 'bar' },
- 'unmodified' => {},
+ data_bag "x", {
+ "added" => {},
+ "modified" => { "foo" => "bar" },
+ "unmodified" => {},
}
end
- it 'knife download of the modified file succeeds' do
- knife('download /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife download of the modified file succeeds" do
+ knife("download /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the unmodified file does nothing' do
- knife('download /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the unmodified file does nothing" do
+ knife("download /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the added file succeeds' do
- knife('download /data_bags/x/added.json').should_succeed <<EOM
+ it "knife download of the added file succeeds" do
+ knife("download /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the deleted file does nothing' do
- knife('download /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the deleted file does nothing" do
+ knife("download /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the deleted file deletes it' do
- knife('download --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife download --purge of the deleted file deletes it" do
+ knife("download --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife download of the entire data bag downloads everything' do
- knife('download /data_bags/x').should_succeed <<EOM
+ it "knife download of the entire data bag downloads everything" do
+ knife("download /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the entire data bag downloads everything' do
- knife('download --purge /data_bags/x').should_succeed <<EOM
+ it "knife download --purge of the entire data bag downloads everything" do
+ knife("download --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife download fails' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download fails" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
- it 'knife download --purge . downloads everything' do
- knife('download --purge .').should_succeed <<EOM
+ it "knife download --purge . downloads everything" do
+ knife("download --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife download --purge * downloads everything' do
- knife('download --purge *').should_succeed <<EOM
+ it "knife download --purge * downloads everything" do
+ knife("download --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', 'name "x"; version "1.0.0"#unmodified'
- file 'cookbooks/x-1.0.0/z.rb', ''
+ file "cookbooks/x-1.0.0/metadata.rb", 'name "x"; version "1.0.0"#unmodified'
+ file "cookbooks/x-1.0.0/z.rb", ""
end
- when_the_chef_server 'has a modified, added and deleted file for the cookbook' do
+ when_the_chef_server "has a modified, added and deleted file for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'y.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "y.rb" => "hi" }
end
- it 'knife download of a modified file succeeds' do
- knife('download /cookbooks/x-1.0.0/metadata.rb').should_succeed "Updated /cookbooks/x-1.0.0/metadata.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a modified file succeeds" do
+ knife("download /cookbooks/x-1.0.0/metadata.rb").should_succeed "Updated /cookbooks/x-1.0.0/metadata.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.0/y.rb
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download of a deleted file does nothing' do
- knife('download /cookbooks/x-1.0.0/z.rb').should_succeed ''
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a deleted file does nothing" do
+ knife("download /cookbooks/x-1.0.0/z.rb").should_succeed ""
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/metadata.rb
D\t/cookbooks/x-1.0.0/y.rb
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download --purge of a deleted file succeeds' do
- knife('download --purge /cookbooks/x-1.0.0/z.rb').should_succeed "Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download --purge of a deleted file succeeds" do
+ knife("download --purge /cookbooks/x-1.0.0/z.rb").should_succeed "Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/metadata.rb
D\t/cookbooks/x-1.0.0/y.rb
EOM
end
- it 'knife download of an added file succeeds' do
- knife('download /cookbooks/x-1.0.0/y.rb').should_succeed "Created /cookbooks/x-1.0.0/y.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of an added file succeeds" do
+ knife("download /cookbooks/x-1.0.0/y.rb").should_succeed "Created /cookbooks/x-1.0.0/y.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/metadata.rb
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download of the cookbook itself succeeds' do
- knife('download /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife download of the cookbook itself succeeds" do
+ knife("download /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0/metadata.rb
Created /cookbooks/x-1.0.0/y.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download --purge of the cookbook itself succeeds' do
- knife('download --purge /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife download --purge of the cookbook itself succeeds" do
+ knife("download --purge /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0/metadata.rb
Created /cookbooks/x-1.0.0/y.rb
Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x-1.0.0/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb
Created /cookbooks/x-1.0.1
Created /cookbooks/x-1.0.1/metadata.rb
Created /cookbooks/x-1.0.1/onlyin1.0.1.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download /cookbooks downloads the updated file' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download /cookbooks downloads the updated file" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-0.9.9
Created /cookbooks/x-0.9.9/metadata.rb
Created /cookbooks/x-0.9.9/onlyin0.9.9.rb
Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-1.0.1
Created /cookbooks/x-1.0.1/metadata.rb
Created /cookbooks/x-1.0.1/onlyin1.0.1.rb
Deleted extra entry /cookbooks/x-1.0.0 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download --purge /cookbooks downloads the old version and deletes the new version' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download --purge /cookbooks downloads the old version and deletes the new version" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-0.9.9
Created /cookbooks/x-0.9.9/metadata.rb
Created /cookbooks/x-0.9.9/onlyin0.9.9.rb
Deleted extra entry /cookbooks/x-1.0.0 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
end # with versioned cookbooks
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'x', '1.0.0'
+ cookbook "x", "1.0.0"
end
- when_the_repository 'is empty' do
- it 'knife download /cookbooks/x signs all requests' do
+ when_the_repository "is empty" do
+ it "knife download /cookbooks/x signs all requests" do
# Check that BasicClient.request() always gets called with X-OPS-USERID
original_new = Chef::HTTP::BasicClient.method(:new)
@@ -1077,13 +1077,13 @@ EOM
new_result = original_new.call(*args)
original_request = new_result.method(:request)
expect(new_result).to receive(:request) { |method, url, body, headers, &response_handler|
- expect(headers['X-OPS-USERID']).not_to be_nil
+ expect(headers["X-OPS-USERID"]).not_to be_nil
original_request.call(method, url, body, headers, &response_handler)
}.at_least(:once)
new_result
}.at_least(:once)
- knife('download /cookbooks/x').should_succeed <<EOM
+ knife("download /cookbooks/x").should_succeed <<EOM
Created /cookbooks
Created /cookbooks/x
Created /cookbooks/x/metadata.rb
@@ -1094,19 +1094,19 @@ EOM
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- user 'foo', {}
- user 'bar', {}
- user 'foobar', {}
- organization 'foo', { 'full_name' => 'Something' }
+ user "foo", {}
+ user "bar", {}
+ user "foobar", {}
+ organization "foo", { "full_name" => "Something" }
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
when_the_repository "has all the default stuff" do
before do
- knife('download /').should_succeed <<EOM
+ knife("download /").should_succeed <<EOM
Created /acls
Created /acls/clients
Created /acls/clients/foo-validator.json
@@ -1167,31 +1167,31 @@ Created /roles
EOM
end
- context 'and the server has one of each thing' do
+ context "and the server has one of each thing" do
before do
# acl_for %w(organizations foo groups blah)
- client 'x', {}
- cookbook 'x', '1.0.0'
- container 'x', {}
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- group 'x', {}
- org_invite 'foo'
- org_member 'bar'
- node 'x', {}
- policy 'x', '1.0.0', {}
- policy 'blah', '1.0.0', {}
- policy_group 'x', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.0' },
- 'blah' => { 'revision_id' => '1.0.0' },
+ client "x", {}
+ cookbook "x", "1.0.0"
+ container "x", {}
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ group "x", {}
+ org_invite "foo"
+ org_member "bar"
+ node "x", {}
+ policy "x", "1.0.0", {}
+ policy "blah", "1.0.0", {}
+ policy_group "x", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.0" },
+ "blah" => { "revision_id" => "1.0.0" },
}
}
- role 'x', {}
+ role "x", {}
end
before do
- knife('download /acls /groups/clients.json /groups/users.json').should_succeed <<-EOM
+ knife("download /acls /groups/clients.json /groups/users.json").should_succeed <<-EOM
Created /acls/clients/x.json
Created /acls/containers/x.json
Created /acls/cookbooks/x.json
@@ -1205,8 +1205,8 @@ Updated /groups/users.json
EOM
end
- it 'knife download / downloads everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download / downloads everything" do
+ knife("download /").should_succeed <<EOM
Created /clients/x.json
Created /containers/x.json
Created /cookbooks/x
@@ -1223,58 +1223,58 @@ Created /policies/x-1.0.0.json
Created /policy_groups/x.json
Created /roles/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
context "and the repository has an identical copy of each thing" do
before do
# TODO We have to upload acls for an existing group due to a lack of
# dependency detection during upload. Fix that!
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'containers/x.json', {}
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/x.json', {}
- file 'groups/x.json', {}
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
- file 'nodes/x.json', {}
- file 'org.json', { 'full_name' => 'Something' }
- file 'policies/x-1.0.0.json', { }
- file 'policies/blah-1.0.0.json', { }
- file 'policy_groups/x.json', { 'policies' => { 'x' => { 'revision_id' => '1.0.0' }, 'blah' => { 'revision_id' => '1.0.0' } } }
- file 'roles/x.json', {}
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "containers/x.json", {}
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/x.json", {}
+ file "groups/x.json", {}
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
+ file "nodes/x.json", {}
+ file "org.json", { "full_name" => "Something" }
+ file "policies/x-1.0.0.json", { }
+ file "policies/blah-1.0.0.json", { }
+ file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
+ file "roles/x.json", {}
end
- it 'knife download makes no changes' do
- knife('download /').should_succeed ''
+ it "knife download makes no changes" do
+ knife("download /").should_succeed ""
end
end
context "and the repository has a slightly different copy of each thing" do
before do
# acl_for %w(organizations foo groups blah)
- file 'clients/x.json', { 'validator' => true }
- file 'containers/x.json', {}
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.1")
- file 'data_bags/x/y.json', { 'a' => 'b' }
- file 'environments/x.json', { 'description' => 'foo' }
- file 'groups/x.json', { 'description' => 'foo' }
- file 'groups/x.json', { 'groups' => [ 'admin' ] }
- file 'nodes/x.json', { 'run_list' => [ 'blah' ] }
- file 'org.json', { 'full_name' => 'Something Else ' }
- file 'policies/x-1.0.0.json', { 'run_list' => [ 'blah' ] }
- file 'policy_groups/x.json', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.1' },
- 'y' => { 'revision_id' => '1.0.0' },
+ file "clients/x.json", { "validator" => true }
+ file "containers/x.json", {}
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.1")
+ file "data_bags/x/y.json", { "a" => "b" }
+ file "environments/x.json", { "description" => "foo" }
+ file "groups/x.json", { "description" => "foo" }
+ file "groups/x.json", { "groups" => [ "admin" ] }
+ file "nodes/x.json", { "run_list" => [ "blah" ] }
+ file "org.json", { "full_name" => "Something Else " }
+ file "policies/x-1.0.0.json", { "run_list" => [ "blah" ] }
+ file "policy_groups/x.json", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.1" },
+ "y" => { "revision_id" => "1.0.0" },
}
}
- file 'roles/x.json', { 'run_list' => [ 'blah' ] }
+ file "roles/x.json", { "run_list" => [ "blah" ] }
end
- it 'knife download updates everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download updates everything" do
+ knife("download /").should_succeed <<EOM
Updated /clients/x.json
Updated /cookbooks/x/metadata.rb
Updated /data_bags/x/y.json
@@ -1289,7 +1289,7 @@ Updated /policies/x-1.0.0.json
Updated /policy_groups/x.json
Updated /roles/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index eb2ed279e5..32f5bb43f8 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
-describe 'knife list', :workstation do
+describe "knife list", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -27,7 +27,7 @@ describe 'knife list', :workstation do
when_the_chef_server "is empty" do
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/clients
/cookbooks
/data_bags
@@ -39,7 +39,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
clients
cookbooks
@@ -72,27 +72,27 @@ EOM
when_the_chef_server "has plenty of stuff in it" do
before do
- client 'client1', {}
- client 'client2', {}
- cookbook 'cookbook1', '1.0.0'
- cookbook 'cookbook2', '1.0.1', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'bag1', { 'item1' => {}, 'item2' => {} }
- data_bag 'bag2', { 'item1' => {}, 'item2' => {} }
- environment 'environment1', {}
- environment 'environment2', {}
- node 'node1', {}
- node 'node2', {}
- policy 'policy1', '1.2.3', {}
- policy 'policy2', '1.2.3', {}
- policy 'policy2', '1.3.5', {}
- role 'role1', {}
- role 'role2', {}
- user 'user1', {}
- user 'user2', {}
+ client "client1", {}
+ client "client2", {}
+ cookbook "cookbook1", "1.0.0"
+ cookbook "cookbook2", "1.0.1", { "recipes" => { "default.rb" => "" } }
+ data_bag "bag1", { "item1" => {}, "item2" => {} }
+ data_bag "bag2", { "item1" => {}, "item2" => {} }
+ environment "environment1", {}
+ environment "environment2", {}
+ node "node1", {}
+ node "node2", {}
+ policy "policy1", "1.2.3", {}
+ policy "policy2", "1.2.3", {}
+ policy "policy2", "1.3.5", {}
+ role "role1", {}
+ role "role2", {}
+ user "user1", {}
+ user "user2", {}
end
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/clients
/cookbooks
/data_bags
@@ -104,7 +104,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
clients
cookbooks
@@ -167,7 +167,7 @@ EOM
end
it "knife list -R --flat / returns everything" do
- knife('list -R --flat /').should_succeed <<-EOM
+ knife("list -R --flat /").should_succeed <<-EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -205,7 +205,7 @@ EOM
end
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -243,18 +243,18 @@ EOM
end
it "knife list /cookbooks returns the list of cookbooks" do
- knife('list /cookbooks').should_succeed <<-EOM
+ knife("list /cookbooks").should_succeed <<-EOM
/cookbooks/cookbook1
/cookbooks/cookbook2
EOM
end
it "knife list /cookbooks/*2/*/*.rb returns the one file" do
- knife('list /cookbooks/*2/*/*.rb').should_succeed "/cookbooks/cookbook2/recipes/default.rb\n"
+ knife("list /cookbooks/*2/*/*.rb").should_succeed "/cookbooks/cookbook2/recipes/default.rb\n"
end
it "knife list /**.rb returns all ruby files" do
- knife('list /**.rb').should_succeed <<-EOM
+ knife("list /**.rb").should_succeed <<-EOM
/cookbooks/cookbook1/metadata.rb
/cookbooks/cookbook2/metadata.rb
/cookbooks/cookbook2/recipes/default.rb
@@ -262,7 +262,7 @@ EOM
end
it "knife list /cookbooks/**.rb returns all ruby files" do
- knife('list /cookbooks/**.rb').should_succeed <<-EOM
+ knife("list /cookbooks/**.rb").should_succeed <<-EOM
/cookbooks/cookbook1/metadata.rb
/cookbooks/cookbook2/metadata.rb
/cookbooks/cookbook2/recipes/default.rb
@@ -270,7 +270,7 @@ EOM
end
it "knife list /**.json returns all json files" do
- knife('list /**.json').should_succeed <<-EOM
+ knife("list /**.json").should_succeed <<-EOM
/clients/chef-validator.json
/clients/chef-webui.json
/clients/client1.json
@@ -293,7 +293,7 @@ EOM
end
it "knife list /data**.json returns all data bag json files" do
- knife('list /data**.json').should_succeed <<-EOM
+ knife("list /data**.json").should_succeed <<-EOM
/data_bags/bag1/item1.json
/data_bags/bag1/item2.json
/data_bags/bag2/item1.json
@@ -302,30 +302,30 @@ EOM
end
it "knife list /environments/missing_file.json reports missing file" do
- knife('list /environments/missing_file.json').should_fail "ERROR: /environments/missing_file.json: No such file or directory\n"
+ knife("list /environments/missing_file.json").should_fail "ERROR: /environments/missing_file.json: No such file or directory\n"
end
context "missing file/directory exact match tests" do
it "knife list /blarghle reports missing directory" do
- knife('list /blarghle').should_fail "ERROR: /blarghle: No such file or directory\n"
+ knife("list /blarghle").should_fail "ERROR: /blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle reports missing directory" do
- knife('list /roles/blarghle').should_fail "ERROR: /roles/blarghle: No such file or directory\n"
+ knife("list /roles/blarghle").should_fail "ERROR: /roles/blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle/blorghle reports missing directory" do
- knife('list /roles/blarghle/blorghle').should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
+ knife("list /roles/blarghle/blorghle").should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
end
end
- context 'symlink tests' do
- when_the_repository 'is empty' do
- context 'when cwd is at the top of the repository' do
- before { cwd '.' }
+ context "symlink tests" do
+ when_the_repository "is empty" do
+ context "when cwd is at the top of the repository" do
+ before { cwd "." }
it "knife list -Rfp returns everything" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
clients/
clients/chef-validator.json
clients/chef-webui.json
@@ -364,13 +364,13 @@ EOM
end
end
- when_the_repository 'has a cookbooks directory' do
- before { directory 'cookbooks' }
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ when_the_repository "has a cookbooks directory" do
+ before { directory "cookbooks" }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -408,7 +408,7 @@ EOM
end
it "knife list -Rfp .. returns everything" do
- knife('list -Rfp ..').should_succeed <<-EOM
+ knife("list -Rfp ..").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -446,7 +446,7 @@ EOM
end
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -458,14 +458,14 @@ EOM
end
end
- when_the_repository 'has a cookbooks/cookbook2 directory' do
- before { directory 'cookbooks/cookbook2' }
+ when_the_repository "has a cookbooks/cookbook2 directory" do
+ before { directory "cookbooks/cookbook2" }
- context 'when cwd is in cookbooks/cookbook2' do
- before { cwd 'cookbooks/cookbook2' }
+ context "when cwd is in cookbooks/cookbook2" do
+ before { cwd "cookbooks/cookbook2" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
metadata.rb
recipes/
recipes/default.rb
@@ -474,17 +474,17 @@ EOM
end
end
- when_the_repository 'has a cookbooks directory and a symlinked cookbooks directory', :skip => (Chef::Platform.windows?) do
+ when_the_repository "has a cookbooks directory and a symlinked cookbooks directory", :skip => (Chef::Platform.windows?) do
before do
- directory 'cookbooks'
- symlink 'symlinked', 'cookbooks'
+ directory "cookbooks"
+ symlink "symlinked", "cookbooks"
end
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -495,11 +495,11 @@ EOM
end
end
- context 'when cwd is in symlinked/' do
- before { cwd 'symlinked' }
+ context "when cwd is in symlinked/" do
+ before { cwd "symlinked" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -511,17 +511,17 @@ EOM
end
end
- when_the_repository 'has a real_cookbooks directory and a cookbooks symlink to it', :skip => (Chef::Platform.windows?) do
+ when_the_repository "has a real_cookbooks directory and a cookbooks symlink to it", :skip => (Chef::Platform.windows?) do
before do
- directory 'real_cookbooks'
- symlink 'cookbooks', 'real_cookbooks'
+ directory "real_cookbooks"
+ symlink "cookbooks", "real_cookbooks"
end
- context 'when cwd is in real_cookbooks/' do
- before { cwd 'real_cookbooks' }
+ context "when cwd is in real_cookbooks/" do
+ before { cwd "real_cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -532,11 +532,11 @@ EOM
end
end
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -553,51 +553,51 @@ EOM
context "--local" do
when_the_repository "is empty" do
it "knife list --local / returns nothing" do
- knife('list --local /').should_succeed ""
+ knife("list --local /").should_succeed ""
end
it "knife list /roles returns nothing" do
- knife('list --local /roles').should_fail "ERROR: /roles: No such file or directory\n"
+ knife("list --local /roles").should_fail "ERROR: /roles: No such file or directory\n"
end
end
when_the_repository "has a bunch of stuff" do
before do
- file 'clients/client1.json', {}
- file 'clients/client2.json', {}
+ file "clients/client1.json", {}
+ file "clients/client2.json", {}
- directory 'cookbooks/cookbook1' do
- file 'metadata.rb', cb_metadata("cookbook1", "1.0.0")
+ directory "cookbooks/cookbook1" do
+ file "metadata.rb", cb_metadata("cookbook1", "1.0.0")
end
- directory 'cookbooks/cookbook2' do
- file 'metadata.rb', cb_metadata("cookbook2", "2.0.0")
- file 'recipes/default.rb', ''
+ directory "cookbooks/cookbook2" do
+ file "metadata.rb", cb_metadata("cookbook2", "2.0.0")
+ file "recipes/default.rb", ""
end
- directory 'data_bags' do
- directory 'bag1' do
- file 'item1.json', {}
- file 'item2.json', {}
+ directory "data_bags" do
+ directory "bag1" do
+ file "item1.json", {}
+ file "item2.json", {}
end
- directory 'bag2' do
- file 'item1.json', {}
- file 'item2.json', {}
+ directory "bag2" do
+ file "item1.json", {}
+ file "item2.json", {}
end
end
- file 'environments/environment1.json', {}
- file 'environments/environment2.json', {}
- file 'nodes/node1.json', {}
- file 'nodes/node2.json', {}
+ file "environments/environment1.json", {}
+ file "environments/environment2.json", {}
+ file "nodes/node1.json", {}
+ file "nodes/node2.json", {}
- file 'roles/role1.json', {}
- file 'roles/role2.json', {}
- file 'users/user1.json', {}
- file 'users/user2.json', {}
+ file "roles/role1.json", {}
+ file "roles/role2.json", {}
+ file "users/user1.json", {}
+ file "users/user2.json", {}
end
it "knife list -Rfp / returns everything" do
- knife('list -Rp --local --flat /').should_succeed <<-EOM
+ knife("list -Rp --local --flat /").should_succeed <<-EOM
/clients/
/clients/client1.json
/clients/client2.json
@@ -632,15 +632,15 @@ EOM
context "missing file/directory tests" do
it "knife list --local /blarghle reports missing directory" do
- knife('list --local /blarghle').should_fail "ERROR: /blarghle: No such file or directory\n"
+ knife("list --local /blarghle").should_fail "ERROR: /blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle reports missing directory" do
- knife('list --local /roles/blarghle').should_fail "ERROR: /roles/blarghle: No such file or directory\n"
+ knife("list --local /roles/blarghle").should_fail "ERROR: /roles/blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle/blorghle reports missing directory" do
- knife('list --local /roles/blarghle/blorghle').should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
+ knife("list --local /roles/blarghle/blorghle").should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
end
end
end
@@ -648,16 +648,16 @@ EOM
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- organization 'foo'
+ organization "foo"
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- context 'and is empty' do
+ context "and is empty" do
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/acls
/clients
/containers
@@ -676,7 +676,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
acls
clients
@@ -777,8 +777,8 @@ EOM
end
end
- it 'knife list -R / returns everything' do
- knife('list -R /').should_succeed <<-EOM
+ it "knife list -R / returns everything" do
+ knife("list -R /").should_succeed <<-EOM
/:
acls
clients
@@ -880,35 +880,35 @@ EOM
context "has plenty of stuff in it" do
before do
- client 'client1', {}
- client 'client2', {}
- container 'container1', {}
- container 'container2', {}
- cookbook 'cookbook1', '1.0.0'
- cookbook 'cookbook2', '1.0.1', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'bag1', { 'item1' => {}, 'item2' => {} }
- data_bag 'bag2', { 'item1' => {}, 'item2' => {} }
- environment 'environment1', {}
- environment 'environment2', {}
- group 'group1', {}
- group 'group2', {}
- node 'node1', {}
- node 'node2', {}
- org_invite 'user1'
- org_member 'user2'
- policy 'policy1', '1.2.3', {}
- policy 'policy2', '1.2.3', {}
- policy 'policy2', '1.3.5', {}
- policy_group 'policy_group1', { 'policies' => { 'policy1' => { 'revision_id' => '1.2.3' } } }
- policy_group 'policy_group2', { 'policies' => { 'policy2' => { 'revision_id' => '1.3.5' } } }
- role 'role1', {}
- role 'role2', {}
- user 'user1', {}
- user 'user2', {}
+ client "client1", {}
+ client "client2", {}
+ container "container1", {}
+ container "container2", {}
+ cookbook "cookbook1", "1.0.0"
+ cookbook "cookbook2", "1.0.1", { "recipes" => { "default.rb" => "" } }
+ data_bag "bag1", { "item1" => {}, "item2" => {} }
+ data_bag "bag2", { "item1" => {}, "item2" => {} }
+ environment "environment1", {}
+ environment "environment2", {}
+ group "group1", {}
+ group "group2", {}
+ node "node1", {}
+ node "node2", {}
+ org_invite "user1"
+ org_member "user2"
+ policy "policy1", "1.2.3", {}
+ policy "policy2", "1.2.3", {}
+ policy "policy2", "1.3.5", {}
+ policy_group "policy_group1", { "policies" => { "policy1" => { "revision_id" => "1.2.3" } } }
+ policy_group "policy_group2", { "policies" => { "policy2" => { "revision_id" => "1.3.5" } } }
+ role "role1", {}
+ role "role2", {}
+ user "user1", {}
+ user "user2", {}
end
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/acls/
/acls/clients/
/acls/clients/client1.json
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb
index 75fc8fa55e..92b972b87b 100644
--- a/spec/integration/knife/raw_spec.rb
+++ b/spec/integration/knife/raw_spec.rb
@@ -15,12 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/raw'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/raw"
+require "chef/knife/show"
-describe 'knife raw', :workstation do
+describe "knife raw", :workstation do
include IntegrationSupport
include KnifeSupport
include AppServerSupport
@@ -29,17 +29,17 @@ describe 'knife raw', :workstation do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- it 'knife raw /nodes/x returns the node', :skip => (RUBY_VERSION < "1.9") do
- knife('raw /nodes/x').should_succeed <<EOM
+ it "knife raw /nodes/x returns the node", :skip => (RUBY_VERSION < "1.9") do
+ knife("raw /nodes/x").should_succeed <<EOM
{
"name": "x",
"json_class": "Chef::Node",
@@ -64,12 +64,12 @@ describe 'knife raw', :workstation do
EOM
end
- it 'knife raw /blarghle returns 404' do
- knife('raw /blarghle').should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/)
+ it "knife raw /blarghle returns 404" do
+ knife("raw /blarghle").should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/)
end
- it 'knife raw -m DELETE /roles/x succeeds', :skip => (RUBY_VERSION < "1.9") do
- knife('raw -m DELETE /roles/x').should_succeed <<EOM
+ it "knife raw -m DELETE /roles/x succeeds", :skip => (RUBY_VERSION < "1.9") do
+ knife("raw -m DELETE /roles/x").should_succeed <<EOM
{
"name": "x",
"description": "",
@@ -89,11 +89,11 @@ EOM
}
}
EOM
- knife('show /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ knife("show /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n"
end
- it 'knife raw -m PUT -i blah.txt /roles/x succeeds', :skip => (RUBY_VERSION < "1.9") do
- Tempfile.open('raw_put_input') do |file|
+ it "knife raw -m PUT -i blah.txt /roles/x succeeds", :skip => (RUBY_VERSION < "1.9") do
+ Tempfile.open("raw_put_input") do |file|
file.write <<EOM
{
"name": "x",
@@ -136,7 +136,7 @@ EOM
}
}
EOM
- knife('show /roles/x.json').should_succeed <<EOM
+ knife("show /roles/x.json").should_succeed <<EOM
/roles/x.json:
{
"name": "x",
@@ -146,8 +146,8 @@ EOM
end
end
- it 'knife raw -m POST -i blah.txt /roles succeeds', :skip => (RUBY_VERSION < "1.9") do
- Tempfile.open('raw_put_input') do |file|
+ it "knife raw -m POST -i blah.txt /roles succeeds", :skip => (RUBY_VERSION < "1.9") do
+ Tempfile.open("raw_put_input") do |file|
file.write <<EOM
{
"name": "y",
@@ -172,7 +172,7 @@ EOM
"uri": "#{Chef::Config.chef_server_url}/roles/y"
}
EOM
- knife('show /roles/y.json').should_succeed <<EOM
+ knife("show /roles/y.json").should_succeed <<EOM
/roles/y.json:
{
"name": "y",
@@ -182,11 +182,11 @@ EOM
end
end
- context 'When a server returns raw json' do
+ context "When a server returns raw json" do
before :each do
Chef::Config.chef_server_url = "http://localhost:9018"
app = lambda do |env|
- [200, {'Content-Type' => 'application/json' }, ['{ "x": "y", "a": "b" }'] ]
+ [200, {"Content-Type" => "application/json" }, ['{ "x": "y", "a": "b" }'] ]
end
@raw_server, @raw_server_thread = start_app_server(app, 9018)
end
@@ -196,8 +196,8 @@ EOM
@raw_server_thread.kill if @raw_server_thread
end
- it 'knife raw /blah returns the prettified json', :skip => (RUBY_VERSION < "1.9") do
- knife('raw /blah').should_succeed <<EOM
+ it "knife raw /blah returns the prettified json", :skip => (RUBY_VERSION < "1.9") do
+ knife("raw /blah").should_succeed <<EOM
{
"x": "y",
"a": "b"
@@ -205,18 +205,18 @@ EOM
EOM
end
- it 'knife raw --no-pretty /blah returns the raw json' do
- knife('raw --no-pretty /blah').should_succeed <<EOM
+ it "knife raw --no-pretty /blah returns the raw json" do
+ knife("raw --no-pretty /blah").should_succeed <<EOM
{ "x": "y", "a": "b" }
EOM
end
end
- context 'When a server returns text' do
+ context "When a server returns text" do
before :each do
Chef::Config.chef_server_url = "http://localhost:9018"
app = lambda do |env|
- [200, {'Content-Type' => 'text' }, ['{ "x": "y", "a": "b" }'] ]
+ [200, {"Content-Type" => "text" }, ['{ "x": "y", "a": "b" }'] ]
end
@raw_server, @raw_server_thread = start_app_server(app, 9018)
end
@@ -226,14 +226,14 @@ EOM
@raw_server_thread.kill if @raw_server_thread
end
- it 'knife raw /blah returns the raw text' do
- knife('raw /blah').should_succeed(<<EOM)
+ it "knife raw /blah returns the raw text" do
+ knife("raw /blah").should_succeed(<<EOM)
{ "x": "y", "a": "b" }
EOM
end
- it 'knife raw --no-pretty /blah returns the raw text' do
- knife('raw --no-pretty /blah').should_succeed(<<EOM)
+ it "knife raw --no-pretty /blah returns the raw text" do
+ knife("raw --no-pretty /blah").should_succeed(<<EOM)
{ "x": "y", "a": "b" }
EOM
end
diff --git a/spec/integration/knife/redirection_spec.rb b/spec/integration/knife/redirection_spec.rb
index 77bda99453..ee12e85314 100644
--- a/spec/integration/knife/redirection_spec.rb
+++ b/spec/integration/knife/redirection_spec.rb
@@ -15,26 +15,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
-describe 'redirection', :workstation do
+describe "redirection", :workstation do
include IntegrationSupport
include KnifeSupport
include AppServerSupport
include_context "default config options"
- when_the_chef_server 'has a role' do
- before { role 'x', {} }
+ when_the_chef_server "has a role" do
+ before { role "x", {} }
- context 'and another server redirects to it with 302' do
+ context "and another server redirects to it with 302" do
before :each do
real_chef_server_url = Chef::Config.chef_server_url
Chef::Config.chef_server_url = "http://localhost:9018"
app = lambda do |env|
- [302, {'Content-Type' => 'text','Location' => "#{real_chef_server_url}#{env['PATH_INFO']}" }, ['302 found'] ]
+ [302, {"Content-Type" => "text","Location" => "#{real_chef_server_url}#{env['PATH_INFO']}" }, ["302 found"] ]
end
@redirector_server, @redirector_server_thread = start_app_server(app, 9018)
end
@@ -44,8 +44,8 @@ describe 'redirection', :workstation do
@redirector_thread.kill if @redirector_thread
end
- it 'knife list /roles returns the role' do
- knife('list /roles').should_succeed "/roles/x.json\n"
+ it "knife list /roles returns the role" do
+ knife("list /roles").should_succeed "/roles/x.json\n"
end
end
end
diff --git a/spec/integration/knife/serve_spec.rb b/spec/integration/knife/serve_spec.rb
index 7bf7d29b40..74b47c0fe3 100644
--- a/spec/integration/knife/serve_spec.rb
+++ b/spec/integration/knife/serve_spec.rb
@@ -15,34 +15,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/serve'
-require 'chef/server_api'
+require "support/shared/integration/integration_helper"
+require "chef/knife/serve"
+require "chef/server_api"
-describe 'knife serve', :workstation do
+describe "knife serve", :workstation do
include IntegrationSupport
include KnifeSupport
include AppServerSupport
- when_the_repository 'also has one of each thing' do
- before { file 'nodes/x.json', { 'foo' => 'bar' } }
+ when_the_repository "also has one of each thing" do
+ before { file "nodes/x.json", { "foo" => "bar" } }
- it 'knife serve serves up /nodes/x' do
+ it "knife serve serves up /nodes/x" do
exception = nil
t = Thread.new do
begin
- knife('serve --chef-zero-port=8890')
+ knife("serve --chef-zero-port=8890")
rescue
exception = $!
end
end
begin
Chef::Config.log_level = :debug
- Chef::Config.chef_server_url = 'http://localhost:8890'
+ Chef::Config.chef_server_url = "http://localhost:8890"
Chef::Config.node_name = nil
Chef::Config.client_key = nil
api = Chef::ServerAPI.new
- expect(api.get('nodes/x')['name']).to eq('x')
+ expect(api.get("nodes/x")["name"]).to eq("x")
rescue
if exception
raise exception
diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb
index fad5126f66..06183243ee 100644
--- a/spec/integration/knife/show_spec.rb
+++ b/spec/integration/knife/show_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/show"
-describe 'knife show', :workstation do
+describe "knife show", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -27,81 +27,81 @@ describe 'knife show', :workstation do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'also has one of each thing' do
+ when_the_repository "also has one of each thing" do
before do
- file 'clients/x.json', { 'foo' => 'bar' }
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
- file 'data_bags/x/y.json', { 'foo' => 'bar' }
- file 'environments/_default.json', { 'foo' => 'bar' }
- file 'environments/x.json', { 'foo' => 'bar' }
- file 'nodes/x.json', { 'foo' => 'bar' }
- file 'roles/x.json', { 'foo' => 'bar' }
- file 'users/x.json', { 'foo' => 'bar' }
+ file "clients/x.json", { "foo" => "bar" }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", { "foo" => "bar" }
+ file "environments/_default.json", { "foo" => "bar" }
+ file "environments/x.json", { "foo" => "bar" }
+ file "nodes/x.json", { "foo" => "bar" }
+ file "roles/x.json", { "foo" => "bar" }
+ file "users/x.json", { "foo" => "bar" }
end
- it 'knife show /cookbooks/x/metadata.rb shows the remote version' do
- knife('show /cookbooks/x/metadata.rb').should_succeed <<EOM
+ it "knife show /cookbooks/x/metadata.rb shows the remote version" do
+ knife("show /cookbooks/x/metadata.rb").should_succeed <<EOM
/cookbooks/x/metadata.rb:
name "x"; version "1.0.0"
EOM
end
- it 'knife show --local /cookbooks/x/metadata.rb shows the local version' do
- knife('show --local /cookbooks/x/metadata.rb').should_succeed <<EOM
+ it "knife show --local /cookbooks/x/metadata.rb shows the local version" do
+ knife("show --local /cookbooks/x/metadata.rb").should_succeed <<EOM
/cookbooks/x/metadata.rb:
name "x"; version "1.0.0"
EOM
end
- it 'knife show /data_bags/x/y.json shows the remote version' do
- knife('show /data_bags/x/y.json').should_succeed <<EOM
+ it "knife show /data_bags/x/y.json shows the remote version" do
+ knife("show /data_bags/x/y.json").should_succeed <<EOM
/data_bags/x/y.json:
{
"id": "y"
}
EOM
end
- it 'knife show --local /data_bags/x/y.json shows the local version' do
- knife('show --local /data_bags/x/y.json').should_succeed <<EOM
+ it "knife show --local /data_bags/x/y.json shows the local version" do
+ knife("show --local /data_bags/x/y.json").should_succeed <<EOM
/data_bags/x/y.json:
{
"foo": "bar"
}
EOM
end
- it 'knife show /environments/x.json shows the remote version', :skip => (RUBY_VERSION < "1.9") do
- knife('show /environments/x.json').should_succeed <<EOM
+ it "knife show /environments/x.json shows the remote version", :skip => (RUBY_VERSION < "1.9") do
+ knife("show /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
"name": "x"
}
EOM
end
- it 'knife show --local /environments/x.json shows the local version' do
- knife('show --local /environments/x.json').should_succeed <<EOM
+ it "knife show --local /environments/x.json shows the local version" do
+ knife("show --local /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
"foo": "bar"
}
EOM
end
- it 'knife show /roles/x.json shows the remote version', :skip => (RUBY_VERSION < "1.9") do
- knife('show /roles/x.json').should_succeed <<EOM
+ it "knife show /roles/x.json shows the remote version", :skip => (RUBY_VERSION < "1.9") do
+ knife("show /roles/x.json").should_succeed <<EOM
/roles/x.json:
{
"name": "x"
}
EOM
end
- it 'knife show --local /roles/x.json shows the local version' do
- knife('show --local /roles/x.json').should_succeed <<EOM
+ it "knife show --local /roles/x.json shows the local version" do
+ knife("show --local /roles/x.json").should_succeed <<EOM
/roles/x.json:
{
"foo": "bar"
@@ -109,34 +109,34 @@ EOM
EOM
end
# show directory
- it 'knife show /data_bags/x fails' do
- knife('show /data_bags/x').should_fail "ERROR: /data_bags/x: is a directory\n"
+ it "knife show /data_bags/x fails" do
+ knife("show /data_bags/x").should_fail "ERROR: /data_bags/x: is a directory\n"
end
- it 'knife show --local /data_bags/x fails' do
- knife('show --local /data_bags/x').should_fail "ERROR: /data_bags/x: is a directory\n"
+ it "knife show --local /data_bags/x fails" do
+ knife("show --local /data_bags/x").should_fail "ERROR: /data_bags/x: is a directory\n"
end
# show nonexistent file
- it 'knife show /environments/nonexistent.json fails' do
- knife('show /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ it "knife show /environments/nonexistent.json fails" do
+ knife("show /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
end
- it 'knife show --local /environments/nonexistent.json fails' do
- knife('show --local /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ it "knife show --local /environments/nonexistent.json fails" do
+ knife("show --local /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
end
end
end
- when_the_chef_server 'has a hash with multiple keys' do
+ when_the_chef_server "has a hash with multiple keys" do
before do
- environment 'x', {
- 'default_attributes' => { 'foo' => 'bar' },
- 'cookbook_versions' => { 'blah' => '= 1.0.0'},
- 'override_attributes' => { 'x' => 'y' },
- 'description' => 'woo',
- 'name' => 'x',
+ environment "x", {
+ "default_attributes" => { "foo" => "bar" },
+ "cookbook_versions" => { "blah" => "= 1.0.0"},
+ "override_attributes" => { "x" => "y" },
+ "description" => "woo",
+ "name" => "x",
}
end
- it 'knife show shows the attributes in a predetermined order', :skip => (RUBY_VERSION < "1.9") do
- knife('show /environments/x.json').should_succeed <<EOM
+ it "knife show shows the attributes in a predetermined order", :skip => (RUBY_VERSION < "1.9") do
+ knife("show /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
"name": "x",
@@ -155,10 +155,10 @@ EOM
end
end
- when_the_repository 'has an environment with bad JSON' do
- before { file 'environments/x.json', '{' }
- it 'knife show succeeds' do
- knife('show --local /environments/x.json').should_succeed <<EOM
+ when_the_repository "has an environment with bad JSON" do
+ before { file "environments/x.json", "{" }
+ it "knife show succeeds" do
+ knife("show --local /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
EOM
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 6b7679de44..79dae99acf 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -15,44 +15,44 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/upload'
-require 'chef/knife/diff'
-require 'chef/knife/raw'
-require 'chef/json_compat'
+require "support/shared/integration/integration_helper"
+require "chef/knife/upload"
+require "chef/knife/diff"
+require "chef/knife/raw"
+require "chef/json_compat"
-describe 'knife upload', :workstation do
+describe "knife upload", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'without versioned cookbooks' do
+ context "without versioned cookbooks" do
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
- end
-
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
+ end
+
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -67,8 +67,8 @@ D\t/users/x.json
EOM
end
- it 'knife upload --purge deletes everything' do
- knife('upload --purge /').should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
+ it "knife upload --purge deletes everything" do
+ knife("upload --purge /").should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
Deleted extra entry /clients/chef-validator.json (purge is on)
Deleted extra entry /clients/chef-webui.json (purge is on)
Deleted extra entry /clients/x.json (purge is on)
@@ -80,56 +80,56 @@ Deleted extra entry /roles/x.json (purge is on)
Deleted extra entry /users/admin.json (purge is on)
Deleted extra entry /users/x.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/environments/_default.json
EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload makes no changes' do
- knife('upload /cookbooks/x').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload makes no changes" do
+ knife("upload /cookbooks/x").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife upload --purge makes no changes' do
- knife('upload --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload --purge makes no changes" do
+ knife("upload --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', { 'description' => 'blarghle' }
+ file "roles/x.json", { "description" => "blarghle" }
end
- it 'knife upload changes the role' do
- knife('upload /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife upload changes the role" do
+ knife("upload /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife upload --no-diff does not change the role' do
- knife('upload --no-diff /').should_succeed ''
- knife('diff --name-status /').should_succeed "M\t/roles/x.json\n"
+ it "knife upload --no-diff does not change the role" do
+ knife("upload --no-diff /").should_succeed ""
+ knife("diff --name-status /").should_succeed "M\t/roles/x.json\n"
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -148,45 +148,45 @@ EOM
EOM
end
- it 'knife upload / does not change anything' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload / does not change anything" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'when cookbook metadata has a self-dependency' do
+ context "when cookbook metadata has a self-dependency" do
before do
- file 'cookbooks/x/metadata.rb', "name 'x'; version '1.0.0'; depends 'x'"
+ file "cookbooks/x/metadata.rb", "name 'x'; version '1.0.0'; depends 'x'"
end
it "should warn", :chef_lt_13_only do
- knife('upload /cookbooks').should_succeed(
+ knife("upload /cookbooks").should_succeed(
stdout: "Updated /cookbooks/x\n",
stderr: "WARN: Ignoring self-dependency in cookbook x, please remove it (in the future this will be fatal).\n",
)
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
it "should fail in Chef 13", :chef_gte_13_only do
- knife('upload /cookbooks').should_fail ''
+ knife("upload /cookbooks").should_fail ""
# FIXME: include the error message here
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/blah.rb', ''
- file 'cookbooks/y/metadata.rb', cb_metadata("y", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/blah.rb", ""
+ file "cookbooks/y/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload adds the new files' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload adds the new files" do
+ knife("upload /").should_succeed <<EOM
Created /clients/y.json
Updated /cookbooks/x
Created /cookbooks/y
@@ -198,11 +198,11 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff /').should_succeed ''
+ knife("diff /").should_succeed ""
end
- it 'knife upload --no-diff adds the new files' do
- knife('upload --no-diff /').should_succeed <<EOM
+ it "knife upload --no-diff adds the new files" do
+ knife("upload --no-diff /").should_succeed <<EOM
Created /clients/y.json
Updated /cookbooks/x
Created /cookbooks/y
@@ -214,15 +214,15 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -233,8 +233,8 @@ D\t/users
EOM
end
- it 'knife upload --purge deletes nothing' do
- knife('upload --purge /').should_fail <<EOM
+ it "knife upload --purge deletes nothing" do
+ knife("upload --purge /").should_fail <<EOM
ERROR: /clients cannot be deleted.
ERROR: /cookbooks cannot be deleted.
ERROR: /data_bags cannot be deleted.
@@ -243,7 +243,7 @@ ERROR: /nodes cannot be deleted.
ERROR: /roles cannot be deleted.
ERROR: /users cannot be deleted.
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -254,178 +254,178 @@ D\t/users
EOM
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife upload with no parameters reports an error' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload with no parameters reports an error" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
end
end
end
- when_the_chef_server 'is empty' do
- when_the_repository 'has a data bag item' do
+ when_the_chef_server "is empty" do
+ when_the_repository "has a data bag item" do
before do
- file 'data_bags/x/y.json', { 'foo' => 'bar' }
+ file "data_bags/x/y.json", { "foo" => "bar" }
end
- it 'knife upload of the data bag uploads only the values in the data bag item and no other' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload of the data bag uploads only the values in the data bag item and no other" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
EOM
- expect(Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false).keys.sort).to eq([ 'foo', 'id' ])
+ expect(Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, :create_additions => false).keys.sort).to eq([ "foo", "id" ])
end
- it 'knife upload /data_bags/x /data_bags/x/y.json uploads x once' do
- knife('upload /data_bags/x /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload /data_bags/x /data_bags/x/y.json uploads x once" do
+ knife("upload /data_bags/x /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
end
end
- when_the_repository 'has a data bag item with keys chef_type and data_bag' do
+ when_the_repository "has a data bag item with keys chef_type and data_bag" do
before do
- file 'data_bags/x/y.json', { 'chef_type' => 'aaa', 'data_bag' => 'bbb' }
+ file "data_bags/x/y.json", { "chef_type" => "aaa", "data_bag" => "bbb" }
end
- it 'upload preserves chef_type and data_bag' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "upload preserves chef_type and data_bag" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed ''
- result = Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false)
- expect(result.keys.sort).to eq([ 'chef_type', 'data_bag', 'id' ])
- expect(result['chef_type']).to eq('aaa')
- expect(result['data_bag']).to eq('bbb')
+ knife("diff --name-status /data_bags").should_succeed ""
+ result = Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, :create_additions => false)
+ expect(result.keys.sort).to eq([ "chef_type", "data_bag", "id" ])
+ expect(result["chef_type"]).to eq("aaa")
+ expect(result["data_bag"]).to eq("bbb")
end
end
# Test upload of an item when the other end doesn't even have the container
- when_the_repository 'has two data bag items' do
+ when_the_repository "has two data bag items" do
before do
- file 'data_bags/x/y.json', {}
- file 'data_bags/x/z.json', {}
+ file "data_bags/x/y.json", {}
+ file "data_bags/x/z.json", {}
end
- it 'knife upload of one data bag item itself succeeds' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload of one data bag item itself succeeds" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/z.json
EOM
end
end
end
- when_the_chef_server 'has three data bag items' do
+ when_the_chef_server "has three data bag items" do
before do
- data_bag 'x', { 'deleted' => {}, 'modified' => {}, 'unmodified' => {} }
+ data_bag "x", { "deleted" => {}, "modified" => {}, "unmodified" => {} }
end
- when_the_repository 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_repository "has a modified, unmodified, added and deleted data bag item" do
before do
- file 'data_bags/x/added.json', {}
- file 'data_bags/x/modified.json', { 'foo' => 'bar' }
- file 'data_bags/x/unmodified.json', {}
+ file "data_bags/x/added.json", {}
+ file "data_bags/x/modified.json", { "foo" => "bar" }
+ file "data_bags/x/unmodified.json", {}
end
- it 'knife upload of the modified file succeeds' do
- knife('upload /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife upload of the modified file succeeds" do
+ knife("upload /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the unmodified file does nothing' do
- knife('upload /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the unmodified file does nothing" do
+ knife("upload /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the added file succeeds' do
- knife('upload /data_bags/x/added.json').should_succeed <<EOM
+ it "knife upload of the added file succeeds" do
+ knife("upload /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife upload of the deleted file does nothing' do
- knife('upload /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the deleted file does nothing" do
+ knife("upload /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload --purge of the deleted file deletes it' do
- knife('upload --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife upload --purge of the deleted file deletes it" do
+ knife("upload --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the entire data bag uploads everything' do
- knife('upload /data_bags/x').should_succeed <<EOM
+ it "knife upload of the entire data bag uploads everything" do
+ knife("upload /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
EOM
end
- it 'knife upload --purge of the entire data bag uploads everything' do
- knife('upload --purge /data_bags/x').should_succeed <<EOM
+ it "knife upload --purge of the entire data bag uploads everything" do
+ knife("upload --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife upload fails' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload fails" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
- it 'knife upload --purge . uploads everything' do
- knife('upload --purge .').should_succeed <<EOM
+ it "knife upload --purge . uploads everything" do
+ knife("upload --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife upload --purge * uploads everything' do
- knife('upload --purge *').should_succeed <<EOM
+ it "knife upload --purge * uploads everything" do
+ knife("upload --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
@@ -434,128 +434,128 @@ EOM
# Cookbook upload is a funny thing ... direct cookbook upload works, but
# upload of a file is designed not to work at present. Make sure that is the
# case.
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'x', '1.0.0', { 'z.rb' => '' }
+ cookbook "x", "1.0.0", { "z.rb" => "" }
end
- when_the_repository 'has a modified, extra and missing file for the cookbook' do
+ when_the_repository "has a modified, extra and missing file for the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0", "#modified")
- file 'cookbooks/x/y.rb', 'hi'
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "#modified")
+ file "cookbooks/x/y.rb", "hi"
end
- it 'knife upload of any individual file fails' do
- knife('upload /cookbooks/x/metadata.rb').should_fail "ERROR: /cookbooks/x/metadata.rb cannot be updated.\n"
- knife('upload /cookbooks/x/y.rb').should_fail "ERROR: /cookbooks/x cannot have a child created under it.\n"
- knife('upload --purge /cookbooks/x/z.rb').should_fail "ERROR: /cookbooks/x/z.rb cannot be deleted.\n"
+ it "knife upload of any individual file fails" do
+ knife("upload /cookbooks/x/metadata.rb").should_fail "ERROR: /cookbooks/x/metadata.rb cannot be updated.\n"
+ knife("upload /cookbooks/x/y.rb").should_fail "ERROR: /cookbooks/x cannot have a child created under it.\n"
+ knife("upload --purge /cookbooks/x/z.rb").should_fail "ERROR: /cookbooks/x/z.rb cannot be deleted.\n"
end
# TODO this is a bit of an inconsistency: if we didn't specify --purge,
# technically we shouldn't have deleted missing files. But ... cookbooks
# are a special case.
- it 'knife upload of the cookbook itself succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
- it 'knife upload --purge of the cookbook itself succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload --purge of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has a missing file for the cookbook' do
+ when_the_repository "has a missing file for the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has an extra file for the cookbook' do
+ when_the_repository "has an extra file for the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x/z.rb', ''
- file 'cookbooks/x/blah.rb', ''
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/z.rb", ""
+ file "cookbooks/x/blah.rb", ""
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has a different file in the cookbook' do
+ when_the_repository "has a different file in the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
end
- it 'knife upload --freeze freezes the cookbook' do
- knife('upload --freeze /cookbooks/x').should_succeed <<EOM
+ it "knife upload --freeze freezes the cookbook" do
+ knife("upload --freeze /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
# Modify a file and attempt to upload
- file 'cookbooks/x/metadata.rb', 'name "x"; version "1.0.0"#different'
- knife('upload /cookbooks/x').should_fail "ERROR: /cookbooks failed to write: Cookbook x is frozen\n"
+ file "cookbooks/x/metadata.rb", 'name "x"; version "1.0.0"#different'
+ knife("upload /cookbooks/x").should_fail "ERROR: /cookbooks failed to write: Cookbook x is frozen\n"
end
end
end
- when_the_chef_server 'has a frozen cookbook' do
+ when_the_chef_server "has a frozen cookbook" do
before do
- cookbook 'frozencook', '1.0.0', {}, :frozen => true
+ cookbook "frozencook", "1.0.0", {}, :frozen => true
end
- when_the_repository 'has an update to said cookbook' do
+ when_the_repository "has an update to said cookbook" do
before do
- file 'cookbooks/frozencook/metadata.rb', cb_metadata("frozencook", "1.0.0", "# This is different")
+ file "cookbooks/frozencook/metadata.rb", cb_metadata("frozencook", "1.0.0", "# This is different")
end
- it 'knife upload fails to upload the frozen cookbook' do
- knife('upload /cookbooks/frozencook').should_fail "ERROR: /cookbooks failed to write: Cookbook frozencook is frozen\n"
+ it "knife upload fails to upload the frozen cookbook" do
+ knife("upload /cookbooks/frozencook").should_fail "ERROR: /cookbooks failed to write: Cookbook frozencook is frozen\n"
end
- it 'knife upload --force uploads the frozen cookbook' do
- knife('upload --force /cookbooks/frozencook').should_succeed <<EOM
+ it "knife upload --force uploads the frozen cookbook" do
+ knife("upload --force /cookbooks/frozencook").should_succeed <<EOM
Updated /cookbooks/frozencook
EOM
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -563,35 +563,35 @@ EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -599,31 +599,31 @@ EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the new version' do
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the new version" do
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has an environment with bad JSON' do
+ when_the_repository "has an environment with bad JSON" do
before do
- file 'environments/x.json', '{'
+ file "environments/x.json", "{"
end
- it 'knife upload tries and fails' do
+ it "knife upload tries and fails" do
error1 = <<-EOH
WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF
{
@@ -640,75 +640,75 @@ WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error
(right here) ------^
EOH
- knife('upload /environments/x.json').should_fail(error1)
- knife('diff --name-status /environments/x.json').should_succeed("M\t/environments/x.json\n", :stderr => warn)
+ knife("upload /environments/x.json").should_fail(error1)
+ knife("diff --name-status /environments/x.json").should_succeed("M\t/environments/x.json\n", :stderr => warn)
end
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "M\t/environments/x.json\n"
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
- when_the_chef_server 'is empty' do
+ when_the_chef_server "is empty" do
- when_the_repository 'has an environment with the wrong name in the file' do
+ when_the_repository "has an environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "A\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "A\t/environments/x.json\n"
end
end
- when_the_repository 'has an environment with no name in the file' do
+ when_the_repository "has an environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Created /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Created /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has a data bag with no id in the file' do
+ when_the_repository "has a data bag with no id in the file" do
before do
- file 'data_bags/bag/x.json', { 'foo' => 'bar' }
+ file "data_bags/bag/x.json", { "foo" => "bar" }
end
- it 'knife upload succeeds' do
- knife('upload /data_bags/bag/x.json').should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
- knife('diff --name-status /data_bags/bag/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /data_bags/bag/x.json").should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
+ knife("diff --name-status /data_bags/bag/x.json").should_succeed ""
end
end
end
when_the_chef_server "is empty" do
- when_the_repository 'has a cookbook with an invalid chef_version constraint in it' do
+ when_the_repository "has a cookbook with an invalid chef_version constraint in it" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
end
- it 'knife upload succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Created /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
@@ -718,29 +718,29 @@ EOM
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
- end
-
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
+ end
+
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -755,8 +755,8 @@ D\t/users/x.json
EOM
end
- it 'knife upload --purge deletes everything' do
- knife('upload --purge /').should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
+ it "knife upload --purge deletes everything" do
+ knife("upload --purge /").should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
Deleted extra entry /clients/chef-validator.json (purge is on)
Deleted extra entry /clients/chef-webui.json (purge is on)
Deleted extra entry /clients/x.json (purge is on)
@@ -768,52 +768,52 @@ Deleted extra entry /roles/x.json (purge is on)
Deleted extra entry /users/admin.json (purge is on)
Deleted extra entry /users/x.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/environments/_default.json
EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0')
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { 'description' => 'The default Chef environment' }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload makes no changes' do
- knife('upload /cookbooks/x-1.0.0').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload makes no changes" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife upload --purge makes no changes' do
- knife('upload --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload --purge makes no changes" do
+ knife("upload --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', { 'description' => 'blarghle' }
+ file "roles/x.json", { "description" => "blarghle" }
end
- it 'knife upload changes the role' do
- knife('upload /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife upload changes the role" do
+ knife("upload /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -832,28 +832,28 @@ EOM
EOM
end
- it 'knife upload / does not change anything' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload / does not change anything" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/blah.rb', ''
- file 'cookbooks/x-2.0.0/metadata.rb', cb_metadata('x', '2.0.0')
- file 'cookbooks/y-1.0.0/metadata.rb', cb_metadata('y', '1.0.0')
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/blah.rb", ""
+ file "cookbooks/x-2.0.0/metadata.rb", cb_metadata("x", "2.0.0")
+ file "cookbooks/y-1.0.0/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload adds the new files' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload adds the new files" do
+ knife("upload /").should_succeed <<EOM
Created /clients/y.json
Updated /cookbooks/x-1.0.0
Created /cookbooks/x-2.0.0
@@ -866,15 +866,15 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -885,8 +885,8 @@ D\t/users
EOM
end
- it 'knife upload --purge deletes nothing' do
- knife('upload --purge /').should_fail <<EOM
+ it "knife upload --purge deletes nothing" do
+ knife("upload --purge /").should_fail <<EOM
ERROR: /clients cannot be deleted.
ERROR: /cookbooks cannot be deleted.
ERROR: /data_bags cannot be deleted.
@@ -895,7 +895,7 @@ ERROR: /nodes cannot be deleted.
ERROR: /roles cannot be deleted.
ERROR: /users cannot be deleted.
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -906,130 +906,130 @@ D\t/users
EOM
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife upload with no parameters reports an error' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload with no parameters reports an error" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
end
end
end
# Test upload of an item when the other end doesn't even have the container
- when_the_chef_server 'is empty' do
- when_the_repository 'has two data bag items' do
+ when_the_chef_server "is empty" do
+ when_the_repository "has two data bag items" do
before do
- file 'data_bags/x/y.json', {}
- file 'data_bags/x/z.json', {}
+ file "data_bags/x/y.json", {}
+ file "data_bags/x/z.json", {}
end
- it 'knife upload of one data bag item itself succeeds' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload of one data bag item itself succeeds" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/z.json
EOM
end
end
end
- when_the_chef_server 'has three data bag items' do
+ when_the_chef_server "has three data bag items" do
before do
- data_bag 'x', { 'deleted' => {}, 'modified' => {}, 'unmodified' => {} }
+ data_bag "x", { "deleted" => {}, "modified" => {}, "unmodified" => {} }
end
- when_the_repository 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_repository "has a modified, unmodified, added and deleted data bag item" do
before do
- file 'data_bags/x/added.json', {}
- file 'data_bags/x/modified.json', { 'foo' => 'bar' }
- file 'data_bags/x/unmodified.json', {}
+ file "data_bags/x/added.json", {}
+ file "data_bags/x/modified.json", { "foo" => "bar" }
+ file "data_bags/x/unmodified.json", {}
end
- it 'knife upload of the modified file succeeds' do
- knife('upload /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife upload of the modified file succeeds" do
+ knife("upload /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the unmodified file does nothing' do
- knife('upload /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the unmodified file does nothing" do
+ knife("upload /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the added file succeeds' do
- knife('upload /data_bags/x/added.json').should_succeed <<EOM
+ it "knife upload of the added file succeeds" do
+ knife("upload /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife upload of the deleted file does nothing' do
- knife('upload /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the deleted file does nothing" do
+ knife("upload /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload --purge of the deleted file deletes it' do
- knife('upload --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife upload --purge of the deleted file deletes it" do
+ knife("upload --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the entire data bag uploads everything' do
- knife('upload /data_bags/x').should_succeed <<EOM
+ it "knife upload of the entire data bag uploads everything" do
+ knife("upload /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
EOM
end
- it 'knife upload --purge of the entire data bag uploads everything' do
- knife('upload --purge /data_bags/x').should_succeed <<EOM
+ it "knife upload --purge of the entire data bag uploads everything" do
+ knife("upload --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife upload fails' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload fails" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
- it 'knife upload --purge . uploads everything' do
- knife('upload --purge .').should_succeed <<EOM
+ it "knife upload --purge . uploads everything" do
+ knife("upload --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife upload --purge * uploads everything' do
- knife('upload --purge *').should_succeed <<EOM
+ it "knife upload --purge * uploads everything" do
+ knife("upload --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
@@ -1038,271 +1038,271 @@ EOM
# Cookbook upload is a funny thing ... direct cookbook upload works, but
# upload of a file is designed not to work at present. Make sure that is the
# case.
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'x', '1.0.0', { 'z.rb' => '' }
+ cookbook "x", "1.0.0", { "z.rb" => "" }
end
- when_the_repository 'has a modified, extra and missing file for the cookbook' do
+ when_the_repository "has a modified, extra and missing file for the cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0', '#modified')
- file 'cookbooks/x-1.0.0/y.rb', 'hi'
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", '#modified')
+ file "cookbooks/x-1.0.0/y.rb", "hi"
end
- it 'knife upload of any individual file fails' do
- knife('upload /cookbooks/x-1.0.0/metadata.rb').should_fail "ERROR: /cookbooks/x-1.0.0/metadata.rb cannot be updated.\n"
- knife('upload /cookbooks/x-1.0.0/y.rb').should_fail "ERROR: /cookbooks/x-1.0.0 cannot have a child created under it.\n"
- knife('upload --purge /cookbooks/x-1.0.0/z.rb').should_fail "ERROR: /cookbooks/x-1.0.0/z.rb cannot be deleted.\n"
+ it "knife upload of any individual file fails" do
+ knife("upload /cookbooks/x-1.0.0/metadata.rb").should_fail "ERROR: /cookbooks/x-1.0.0/metadata.rb cannot be updated.\n"
+ knife("upload /cookbooks/x-1.0.0/y.rb").should_fail "ERROR: /cookbooks/x-1.0.0 cannot have a child created under it.\n"
+ knife("upload --purge /cookbooks/x-1.0.0/z.rb").should_fail "ERROR: /cookbooks/x-1.0.0/z.rb cannot be deleted.\n"
end
# TODO this is a bit of an inconsistency: if we didn't specify --purge,
# technically we shouldn't have deleted missing files. But ... cookbooks
# are a special case.
- it 'knife upload of the cookbook itself succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
- it 'knife upload --purge of the cookbook itself succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload --purge of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has a missing file for the cookbook' do
+ when_the_repository "has a missing file for the cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', "1.0.0")
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has an extra file for the cookbook' do
+ when_the_repository "has an extra file for the cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x-1.0.0/z.rb', ''
- file 'cookbooks/x-1.0.0/blah.rb', ''
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/z.rb", ""
+ file "cookbooks/x-1.0.0/blah.rb", ""
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x-1.0.0/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/onlyin1.0.0.rb
D\t/cookbooks/x-1.0.1
EOM
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-1.0.1 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks uploads the local version' do
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks uploads the local version" do
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-0.9.9 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.1
A\t/cookbooks/x-1.0.0
EOM
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-1.0.1 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the new version' do
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the new version" do
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-0.9.9 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "M\t/environments/x.json\n"
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
- when_the_chef_server 'is empty' do
+ when_the_chef_server "is empty" do
- when_the_repository 'has an environment with the wrong name in the file' do
+ when_the_repository "has an environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "A\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "A\t/environments/x.json\n"
end
end
- when_the_repository 'has an environment with no name in the file' do
+ when_the_repository "has an environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Created /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Created /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has a data bag with no id in the file' do
+ when_the_repository "has a data bag with no id in the file" do
before do
- file 'data_bags/bag/x.json', { 'foo' => 'bar' }
+ file "data_bags/bag/x.json", { "foo" => "bar" }
end
- it 'knife upload succeeds' do
- knife('upload /data_bags/bag/x.json').should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
- knife('diff --name-status /data_bags/bag/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /data_bags/bag/x.json").should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
+ knife("diff --name-status /data_bags/bag/x.json").should_succeed ""
end
end
end
when_the_chef_server "is empty" do
- when_the_repository 'has a cookbook with an invalid chef_version constraint in it' do
+ when_the_repository "has a cookbook with an invalid chef_version constraint in it" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
end
- it 'knife upload succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Created /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
end # with versioned cookbooks
- when_the_chef_server 'has a user' do
+ when_the_chef_server "has a user" do
before do
- user 'x', {}
+ user "x", {}
end
- when_the_repository 'has the same user with json_class in it' do
+ when_the_repository "has the same user with json_class in it" do
before do
- file 'users/x.json', { 'admin' => true, 'json_class' => 'Chef::WebUIUser' }
+ file "users/x.json", { "admin" => true, "json_class" => "Chef::WebUIUser" }
end
- it 'knife upload /users/x.json succeeds' do
- knife('upload /users/x.json').should_succeed "Updated /users/x.json\n"
+ it "knife upload /users/x.json succeeds" do
+ knife("upload /users/x.json").should_succeed "Updated /users/x.json\n"
end
end
end
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- user 'foo', {}
- user 'bar', {}
- user 'foobar', {}
- organization 'foo', { 'full_name' => 'Something' }
+ user "foo", {}
+ user "bar", {}
+ user "foobar", {}
+ organization "foo", { "full_name" => "Something" }
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- context 'and has nothing but a single group named blah' do
- group 'blah', {}
+ context "and has nothing but a single group named blah" do
+ group "blah", {}
- when_the_repository 'has at least one of each thing' do
+ when_the_repository "has at least one of each thing" do
before do
# TODO We have to upload acls for an existing group due to a lack of
# dependency detection during upload. Fix that!
- file 'acls/groups/blah.json', {}
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'containers/x.json', {}
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/x.json', {}
- file 'groups/x.json', {}
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
- file 'org.json', { 'full_name' => 'wootles' }
- file 'nodes/x.json', {}
- file 'policies/x-1.0.0.json', { }
- file 'policies/blah-1.0.0.json', { }
- file 'policy_groups/x.json', { 'policies' => { 'x' => { 'revision_id' => '1.0.0' }, 'blah' => { 'revision_id' => '1.0.0' } } }
- file 'roles/x.json', {}
- end
-
- it 'knife upload / uploads everything' do
- knife('upload /').should_succeed <<EOM
+ file "acls/groups/blah.json", {}
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "containers/x.json", {}
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/x.json", {}
+ file "groups/x.json", {}
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
+ file "org.json", { "full_name" => "wootles" }
+ file "nodes/x.json", {}
+ file "policies/x-1.0.0.json", { }
+ file "policies/blah-1.0.0.json", { }
+ file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
+ file "roles/x.json", {}
+ end
+
+ it "knife upload / uploads everything" do
+ knife("upload /").should_succeed <<EOM
Updated /acls/groups/blah.json
Created /clients/x.json
Created /containers/x.json
@@ -1320,39 +1320,39 @@ Created /policies/x-1.0.0.json
Created /policy_groups/x.json
Created /roles/x.json
EOM
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ])
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
context "When the chef server has an identical copy of each thing" do
before do
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
- file 'org.json', { 'full_name' => 'Something' }
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
+ file "org.json", { "full_name" => "Something" }
# acl_for %w(organizations foo groups blah)
- client 'x', {}
- cookbook 'x', '1.0.0'
- container 'x', {}
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- group 'x', {}
- org_invite 'foo'
- org_member 'bar'
- node 'x', {}
- policy 'x', '1.0.0', {}
- policy 'blah', '1.0.0', {}
- policy_group 'x', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.0' },
- 'blah' => { 'revision_id' => '1.0.0' },
+ client "x", {}
+ cookbook "x", "1.0.0"
+ container "x", {}
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ group "x", {}
+ org_invite "foo"
+ org_member "bar"
+ node "x", {}
+ policy "x", "1.0.0", {}
+ policy "blah", "1.0.0", {}
+ policy_group "x", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.0" },
+ "blah" => { "revision_id" => "1.0.0" },
}
}
- role 'x', {}
+ role "x", {}
end
- it 'knife upload makes no changes' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload makes no changes" do
+ knife("upload /").should_succeed <<EOM
Updated /acls/groups/blah.json
EOM
end
@@ -1360,7 +1360,7 @@ EOM
context "When the chef server has a slightly different copy of the policy revision" do
before do
- policy 'x', '1.0.0', { 'run_list' => [ 'blah' ] }
+ policy "x", "1.0.0", { "run_list" => [ "blah" ] }
end
it "should fail because policies are not updateable" do
@@ -1373,27 +1373,27 @@ EOM
context "When the chef server has a slightly different copy of each thing (except policy revisions)" do
before do
# acl_for %w(organizations foo groups blah)
- client 'x', { 'validator' => true }
- container 'x', {}
- cookbook 'x', '1.0.0', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'x', { 'y' => { 'a' => 'b' } }
- environment 'x', { 'description' => 'foo' }
- group 'x', { 'groups' => [ 'admin' ] }
- node 'x', { 'run_list' => [ 'blah' ] }
- policy 'x', '1.0.0', { }
- policy 'x', '1.0.1', { }
- policy 'y', '1.0.0', { }
- policy_group 'x', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.1' },
- 'y' => { 'revision_id' => '1.0.0' },
+ client "x", { "validator" => true }
+ container "x", {}
+ cookbook "x", "1.0.0", { "recipes" => { "default.rb" => "" } }
+ data_bag "x", { "y" => { "a" => "b" } }
+ environment "x", { "description" => "foo" }
+ group "x", { "groups" => [ "admin" ] }
+ node "x", { "run_list" => [ "blah" ] }
+ policy "x", "1.0.0", { }
+ policy "x", "1.0.1", { }
+ policy "y", "1.0.0", { }
+ policy_group "x", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.1" },
+ "y" => { "revision_id" => "1.0.0" },
}
}
- role 'x', { 'run_list' => [ 'blah' ] }
+ role "x", { "run_list" => [ "blah" ] }
end
- it 'knife upload updates everything' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload updates everything" do
+ knife("upload /").should_succeed <<EOM
Updated /acls/groups/blah.json
Updated /clients/x.json
Updated /cookbooks/x
@@ -1408,103 +1408,103 @@ Created /policies/blah-1.0.0.json
Updated /policy_groups/x.json
Updated /roles/x.json
EOM
- knife('diff --name-status --diff-filter=AMT /').should_succeed ''
+ knife("diff --name-status --diff-filter=AMT /").should_succeed ""
end
end
end
- when_the_repository 'has an org.json that does not change full_name' do
+ when_the_repository "has an org.json that does not change full_name" do
before do
- file 'org.json', { 'full_name' => 'Something' }
+ file "org.json", { "full_name" => "Something" }
end
- it 'knife upload / emits a warning for bar and adds foo and foobar' do
- knife('upload /').should_succeed ''
- expect(api.get('/')['full_name']).to eq('Something')
+ it "knife upload / emits a warning for bar and adds foo and foobar" do
+ knife("upload /").should_succeed ""
+ expect(api.get("/")["full_name"]).to eq("Something")
end
end
- when_the_repository 'has an org.json that changes full_name' do
+ when_the_repository "has an org.json that changes full_name" do
before do
- file 'org.json', { 'full_name' => 'Something Else'}
+ file "org.json", { "full_name" => "Something Else"}
end
- it 'knife upload / emits a warning for bar and adds foo and foobar' do
- knife('upload /').should_succeed "Updated /org.json\n"
- expect(api.get('/')['full_name']).to eq('Something Else')
+ it "knife upload / emits a warning for bar and adds foo and foobar" do
+ knife("upload /").should_succeed "Updated /org.json\n"
+ expect(api.get("/")["full_name"]).to eq("Something Else")
end
end
- context 'and has invited foo and bar is already a member' do
- org_invite 'foo'
- org_member 'bar'
+ context "and has invited foo and bar is already a member" do
+ org_invite "foo"
+ org_member "bar"
- when_the_repository 'wants to invite foo, bar and foobar' do
+ when_the_repository "wants to invite foo, bar and foobar" do
before do
- file 'invitations.json', [ 'foo', 'bar', 'foobar' ]
+ file "invitations.json", [ "foo", "bar", "foobar" ]
end
- it 'knife upload / emits a warning for bar and invites foobar' do
- knife('upload /').should_succeed "Updated /invitations.json\n", :stderr => "WARN: Could not invite bar to organization foo: User bar is already in organization foo\n"
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo', 'foobar' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ])
+ it "knife upload / emits a warning for bar and invites foobar" do
+ knife("upload /").should_succeed "Updated /invitations.json\n", :stderr => "WARN: Could not invite bar to organization foo: User bar is already in organization foo\n"
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo", "foobar" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
end
- when_the_repository 'wants to make foo, bar and foobar members' do
+ when_the_repository "wants to make foo, bar and foobar members" do
before do
- file 'members.json', [ 'foo', 'bar', 'foobar' ]
+ file "members.json", [ "foo", "bar", "foobar" ]
end
- it 'knife upload / emits a warning for bar and adds foo and foobar' do
- knife('upload /').should_succeed "Updated /members.json\n"
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar', 'foo', 'foobar' ])
+ it "knife upload / emits a warning for bar and adds foo and foobar" do
+ knife("upload /").should_succeed "Updated /members.json\n"
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar", "foo", "foobar" ])
end
end
- when_the_repository 'wants to invite foo and have bar as a member' do
+ when_the_repository "wants to invite foo and have bar as a member" do
before do
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
end
- it 'knife upload / does nothing' do
- knife('upload /').should_succeed ''
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ])
+ it "knife upload / does nothing" do
+ knife("upload /").should_succeed ""
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
end
end
- context 'and has invited bar and foo' do
- org_invite 'bar', 'foo'
+ context "and has invited bar and foo" do
+ org_invite "bar", "foo"
- when_the_repository 'wants to invite foo and bar (different order)' do
+ when_the_repository "wants to invite foo and bar (different order)" do
before do
- file 'invitations.json', [ 'foo', 'bar' ]
+ file "invitations.json", [ "foo", "bar" ]
end
- it 'knife upload / does nothing' do
- knife('upload /').should_succeed ''
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'bar', 'foo' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ ])
+ it "knife upload / does nothing" do
+ knife("upload /").should_succeed ""
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "bar", "foo" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ ])
end
end
end
- context 'and has already added bar and foo as members of the org' do
- org_member 'bar', 'foo'
+ context "and has already added bar and foo as members of the org" do
+ org_member "bar", "foo"
- when_the_repository 'wants to add foo and bar (different order)' do
+ when_the_repository "wants to add foo and bar (different order)" do
before do
- file 'members.json', [ 'foo', 'bar' ]
+ file "members.json", [ "foo", "bar" ]
end
- it 'knife upload / does nothing' do
- knife('upload /').should_succeed ''
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar', 'foo' ])
+ it "knife upload / does nothing" do
+ knife("upload /").should_succeed ""
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar", "foo" ])
end
end
end
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index bd5eaf66a4..dc7e19a3cb 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -1,5 +1,5 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "LWRPs with inline resources" do
include IntegrationSupport
@@ -29,7 +29,7 @@ describe "LWRPs with inline resources" do
use_inline_resources
def action_a
r = new_resource
- ruby_block 'run a' do
+ ruby_block "run a" do
block { r.ran_a "ran a" }
end
end
@@ -39,8 +39,8 @@ describe "LWRPs with inline resources" do
it "this is totally a bug, but for backcompat purposes, it adds the resources to the main resource collection and does not get marked updated" do
r = nil
expect_recipe {
- r = lwrp_inline_resources_test 'hi'
- }.to have_updated('ruby_block[run a]', :run)
+ r = lwrp_inline_resources_test "hi"
+ }.to have_updated("ruby_block[run a]", :run)
expect(r.ran_a).to eq "ran a"
end
end
@@ -58,7 +58,7 @@ describe "LWRPs with inline resources" do
action :a do
r = new_resource
- ruby_block 'run a' do
+ ruby_block "run a" do
block { r.ran_a "ran a" }
end
end
@@ -68,7 +68,7 @@ describe "LWRPs with inline resources" do
r = new_resource
# Grab ran_a right now, before we converge
ran_a = r.ran_a
- ruby_block 'run b' do
+ ruby_block "run b" do
block { r.ran_b "ran b: ran_a value was #{ran_a.inspect}" }
end
end
@@ -78,34 +78,34 @@ describe "LWRPs with inline resources" do
it "resources declared in b are executed immediately inline" do
r = nil
expect_recipe {
- r = lwrp_inline_resources_test2 'hi' do
+ r = lwrp_inline_resources_test2 "hi" do
action :b
end
- }.to have_updated('lwrp_inline_resources_test2[hi]', :b).
- and have_updated('ruby_block[run a]', :run).
- and have_updated('ruby_block[run b]', :run)
+ }.to have_updated("lwrp_inline_resources_test2[hi]", :b).
+ and have_updated("ruby_block[run a]", :run).
+ and have_updated("ruby_block[run b]", :run)
expect(r.ran_b).to eq "ran b: ran_a value was \"ran a\""
end
end
when_the_repository "has a cookbook with a nested LWRP" do
before do
- directory 'cookbooks/x' do
+ directory "cookbooks/x" do
- file 'resources/do_nothing.rb', <<-EOM
+ file "resources/do_nothing.rb", <<-EOM
actions :create, :nothing
default_action :create
EOM
- file 'providers/do_nothing.rb', <<-EOM
+ file "providers/do_nothing.rb", <<-EOM
action :create do
end
EOM
- file 'resources/my_machine.rb', <<-EOM
+ file "resources/my_machine.rb", <<-EOM
actions :create, :nothing
default_action :create
EOM
- file 'providers/my_machine.rb', <<-EOM
+ file "providers/my_machine.rb", <<-EOM
use_inline_resources
action :create do
x_do_nothing 'a'
@@ -113,7 +113,7 @@ describe "LWRPs with inline resources" do
end
EOM
- file 'recipes/default.rb', <<-EOM
+ file "recipes/default.rb", <<-EOM
x_my_machine "me"
x_my_machine "you"
EOM
@@ -122,7 +122,7 @@ describe "LWRPs with inline resources" do
end
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
log_level :warn
diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb
index 7ecdfc7c3a..3bc008d4f8 100644
--- a/spec/integration/recipes/lwrp_spec.rb
+++ b/spec/integration/recipes/lwrp_spec.rb
@@ -1,5 +1,5 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "LWRPs" do
include IntegrationSupport
@@ -20,17 +20,17 @@ describe "LWRPs" do
when_the_repository "has a cookbook named l-w-r-p" do
before do
- directory 'cookbooks/l-w-r-p' do
+ directory "cookbooks/l-w-r-p" do
- file 'resources/foo.rb', <<EOM
+ file "resources/foo.rb", <<EOM
default_action :create
EOM
- file 'providers/foo.rb', <<EOM
+ file "providers/foo.rb", <<EOM
action :create do
end
EOM
- file 'recipes/default.rb', <<EOM
+ file "recipes/default.rb", <<EOM
l_w_r_p_foo "me"
EOM
@@ -38,7 +38,7 @@ EOM
end
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
log_level :warn
diff --git a/spec/integration/recipes/provider_choice.rb b/spec/integration/recipes/provider_choice.rb
index 01537b2c05..d08090bbe8 100644
--- a/spec/integration/recipes/provider_choice.rb
+++ b/spec/integration/recipes/provider_choice.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Recipe DSL methods" do
include IntegrationSupport
@@ -26,7 +26,7 @@ describe "Recipe DSL methods" do
it "provider_thingy 'blah' runs the provider and warns" do
recipe = converge {
- provider_thingy 'blah' do; end
+ provider_thingy "blah" do; end
}
expect(recipe.logged_warnings).to match /hello from Chef::Provider::ProviderThingy/
expect(recipe.logged_warnings).to match /you must use 'provides' to provide DSL/i
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb
index 52bca87c99..db4d158eec 100644
--- a/spec/integration/recipes/recipe_dsl_spec.rb
+++ b/spec/integration/recipes/recipe_dsl_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Recipe DSL methods" do
include IntegrationSupport
@@ -15,7 +15,7 @@ describe "Recipe DSL methods" do
before(:context) {
class BaseThingy < Chef::Resource
- resource_name 'base_thingy'
+ resource_name "base_thingy"
default_action :create
class<<self
@@ -51,27 +51,27 @@ describe "Recipe DSL methods" do
it "creates base_thingy when you call base_thingy in a recipe" do
recipe = converge {
- base_thingy 'blah' do; end
+ base_thingy "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
- expect(BaseThingy.created_name).to eq 'blah'
+ expect(recipe.logged_warnings).to eq ""
+ expect(BaseThingy.created_name).to eq "blah"
expect(BaseThingy.created_resource).to eq BaseThingy
end
it "errors out when you call base_thingy do ... end in a recipe" do
expect_converge {
base_thingy do; end
- }.to raise_error(ArgumentError, 'You must supply a name when declaring a base_thingy resource')
+ }.to raise_error(ArgumentError, "You must supply a name when declaring a base_thingy resource")
end
it "emits a warning when you call base_thingy 'foo', 'bar' do ... end in a recipe" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
recipe = converge {
- base_thingy 'foo', 'bar' do
+ base_thingy "foo", "bar" do
end
}
expect(recipe.logged_warnings).to match(/Cannot create resource base_thingy with more than one argument. All arguments except the name \("foo"\) will be ignored. This will cause an error in Chef 13. Arguments: \["foo", "bar"\]/)
- expect(BaseThingy.created_name).to eq 'foo'
+ expect(BaseThingy.created_name).to eq "foo"
expect(BaseThingy.created_resource).to eq BaseThingy
end
@@ -99,7 +99,7 @@ describe "Recipe DSL methods" do
it "backcompat_thingy creates a Chef::Resource::BackcompatThingy" do
recipe = converge {
- backcompat_thingy 'blah' do; end
+ backcompat_thingy "blah" do; end
}
expect(BaseThingy.created_resource).to eq Chef::Resource::BackcompatThingy
expect(BaseThingy.created_provider).to eq Chef::Provider::BackcompatThingy
@@ -117,7 +117,7 @@ describe "Recipe DSL methods" do
it "backcompat_thingy creates a BackcompatThingy" do
recipe = converge {
- backcompat_thingy 'blah' do; end
+ backcompat_thingy "blah" do; end
}
expect(recipe.logged_warnings).to match(/Class Chef::Provider::BackcompatThingy does not declare 'provides :backcompat_thingy'./)
expect(BaseThingy.created_resource).not_to be_nil
@@ -135,7 +135,7 @@ describe "Recipe DSL methods" do
it "bar_thingy does not work" do
expect_converge {
- bar_thingy 'blah' do; end
+ bar_thingy "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -151,7 +151,7 @@ describe "Recipe DSL methods" do
it "no_name_thingy does not work" do
expect_converge {
- no_name_thingy 'blah' do; end
+ no_name_thingy "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -167,15 +167,15 @@ describe "Recipe DSL methods" do
it "another_no_name_thingy does not work" do
expect_converge {
- another_no_name_thingy 'blah' do; end
+ another_no_name_thingy "blah" do; end
}.to raise_error(NoMethodError)
end
it "another_thingy_name works" do
recipe = converge {
- another_thingy_name 'blah' do; end
+ another_thingy_name "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy)
end
end
@@ -192,21 +192,21 @@ describe "Recipe DSL methods" do
it "another_no_name_thingy does not work" do
expect_converge {
- another_no_name_thingy2 'blah' do; end
+ another_no_name_thingy2 "blah" do; end
}.to raise_error(NoMethodError)
end
it "another_thingy_name2 does not work" do
expect_converge {
- another_thingy_name2 'blah' do; end
+ another_thingy_name2 "blah" do; end
}.to raise_error(NoMethodError)
end
it "yet_another_thingy_name3 works" do
recipe = converge {
- another_thingy_name3 'blah' do; end
+ another_thingy_name3 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy2)
end
end
@@ -217,7 +217,7 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy3 < BaseThingy
resource_name :another_no_name_thingy_3
- provides :another_no_name_thingy3, os: 'blarghle'
+ provides :another_no_name_thingy3, os: "blarghle"
end
}
@@ -225,18 +225,18 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy3 does not work" do
expect_converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy3 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy3 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy3 works" do
recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy3 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy3 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy3)
end
end
@@ -246,8 +246,8 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy4 < BaseThingy
resource_name :another_no_name_thingy_4
- provides :another_no_name_thingy4, os: 'blarghle'
- provides :another_no_name_thingy4, platform_family: 'foo'
+ provides :another_no_name_thingy4, os: "blarghle"
+ provides :another_no_name_thingy4, platform_family: "foo"
end
}
@@ -255,28 +255,28 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy4 does not work" do
expect_converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy4 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy4 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy4 works" do
recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy4 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy4 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
end
it "and platform_family = foo, another_no_name_thingy4 works" do
recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:platform_family] = 'foo'
- another_no_name_thingy4 'blah' do; end
+ run_context.node.automatic[:platform_family] = "foo"
+ another_no_name_thingy4 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
end
end
@@ -286,7 +286,7 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy5 < BaseThingy
resource_name :another_thingy_name_for_another_no_name_thingy5
- provides :another_no_name_thingy5, os: 'blarghle'
+ provides :another_no_name_thingy5, os: "blarghle"
end
}
@@ -294,26 +294,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy5 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy5 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy5 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy5 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy5 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy5 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
end
it "the new resource name can be used in a recipe" do
recipe = converge {
- another_thingy_name_for_another_no_name_thingy5 'blah' do; end
+ another_thingy_name_for_another_no_name_thingy5 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
end
end
@@ -322,7 +322,7 @@ describe "Recipe DSL methods" do
before(:context) {
class AnotherNoNameThingy6 < BaseThingy
- provides :another_no_name_thingy6, os: 'blarghle'
+ provides :another_no_name_thingy6, os: "blarghle"
resource_name :another_thingy_name_for_another_no_name_thingy6
end
@@ -331,26 +331,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy6 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy6 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy6 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy6 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy6 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy6 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
end
it "the new resource name can be used in a recipe" do
recipe = converge {
- another_thingy_name_for_another_no_name_thingy6 'blah' do; end
+ another_thingy_name_for_another_no_name_thingy6 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
end
end
@@ -360,7 +360,7 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy7 < BaseThingy
resource_name :another_thingy_name_for_another_no_name_thingy7
- provides :another_thingy_name_for_another_no_name_thingy7, os: 'blarghle'
+ provides :another_thingy_name_for_another_no_name_thingy7, os: "blarghle"
end
}
@@ -368,26 +368,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_thingy_name_for_another_no_name_thingy7 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_thingy_name_for_another_no_name_thingy7 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_thingy_name_for_another_no_name_thingy7 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_thingy_name_for_another_no_name_thingy7 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_thingy_name_for_another_no_name_thingy7 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_thingy_name_for_another_no_name_thingy7 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy7)
end
it "the old resource name does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy_7 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy_7 "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -397,7 +397,7 @@ describe "Recipe DSL methods" do
before(:context) {
class AnotherNoNameThingy8 < BaseThingy
- provides :another_thingy_name_for_another_no_name_thingy8, os: 'blarghle'
+ provides :another_thingy_name_for_another_no_name_thingy8, os: "blarghle"
resource_name :another_thingy_name_for_another_no_name_thingy8
end
@@ -406,26 +406,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_thingy_name_for_another_no_name_thingy8 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_thingy_name_for_another_no_name_thingy8 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_thingy_name_for_another_no_name_thingy8 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_thingy_name_for_another_no_name_thingy8 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_thingy_name_for_another_no_name_thingy8 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_thingy_name_for_another_no_name_thingy8 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy8)
end
it "the old resource name does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_thingy_name8 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_thingy_name8 "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -444,13 +444,13 @@ describe "Recipe DSL methods" do
it "my_supplier does not work in a recipe" do
expect_converge {
- my_supplier 'blah' do; end
+ my_supplier "blah" do; end
}.to raise_error(NoMethodError)
end
it "hemlock works in a recipe" do
expect_recipe {
- hemlock 'blah' do; end
+ hemlock "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::MySupplier
end
@@ -467,7 +467,7 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe" do
expect_recipe {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
@@ -483,14 +483,14 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
recipe = converge {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
it "thingy4 does not work in a recipe" do
expect_converge {
- thingy4 'blah' do; end
+ thingy4 "blah" do; end
}.to raise_error(NoMethodError)
end
@@ -514,7 +514,7 @@ describe "Recipe DSL methods" do
it "thingy5 works in a recipe" do
expect_recipe {
- thingy5 'blah' do; end
+ thingy5 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -531,14 +531,14 @@ describe "Recipe DSL methods" do
it "thingy6 works in a recipe and yields Thingy6" do
recipe = converge {
- thingy6 'blah' do; end
+ thingy6 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy6
end
it "thingy5 works in a recipe and yields Foo::Thingy5 (the alphabetical one)" do
recipe = converge {
- thingy5 'blah' do; end
+ thingy5 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -558,7 +558,7 @@ describe "Recipe DSL methods" do
it "thingy5reverse works in a recipe and yields AThingy5 (the alphabetical one)" do
recipe = converge {
- thingy5reverse 'blah' do; end
+ thingy5reverse "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::AThingy5
end
@@ -577,7 +577,7 @@ describe "Recipe DSL methods" do
it "thingy5_2 works in a recipe and yields the RecipeDSLSpaceNamespace one (the alphabetical one)" do
recipe = converge {
- thingy5_2 'blah' do; end
+ thingy5_2 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -596,7 +596,7 @@ describe "Recipe DSL methods" do
it "thingy5_2reverse works in a recipe and yields the ARecipeDSLSpaceNamespace one (the alphabetical one)" do
recipe = converge {
- thingy5_2reverse 'blah' do; end
+ thingy5_2reverse "blah" do; end
}
expect(BaseThingy.created_resource).to eq ARecipeDSLSpecNamespace::Thingy5
end
@@ -614,7 +614,7 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe" do
expect_recipe {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
@@ -630,14 +630,14 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
recipe = converge {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
it "thingy4 does not work in a recipe" do
expect_converge {
- thingy4 'blah' do; end
+ thingy4 "blah" do; end
}.to raise_error(NoMethodError)
end
@@ -657,14 +657,14 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
recipe = converge {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
it "thingy4 does not work in a recipe" do
expect_converge {
- thingy4 'blah' do; end
+ thingy4 "blah" do; end
}.to raise_error(NoMethodError)
end
@@ -697,14 +697,14 @@ describe "Recipe DSL methods" do
it "thingy7 works in a recipe and yields Thingy7" do
recipe = converge {
- thingy7 'blah' do; end
+ thingy7 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
end
it "thingy8 works in a recipe and yields Thingy7 (alphabetical)" do
recipe = converge {
- thingy8 'blah' do; end
+ thingy8 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
end
@@ -728,21 +728,21 @@ describe "Recipe DSL methods" do
it "thingy12 works in a recipe and yields Thingy12" do
expect_recipe {
- thingy12 'blah' do; end
+ thingy12 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
it "twizzle works in a recipe and yields Thingy12" do
expect_recipe {
- twizzle 'blah' do; end
+ twizzle "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
it "twizzle2 works in a recipe and yields Thingy12" do
expect_recipe {
- twizzle2 'blah' do; end
+ twizzle2 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
@@ -752,20 +752,20 @@ describe "Recipe DSL methods" do
before(:context) {
class MySuperThingyFoo < BaseThingy
resource_name :my_super_thingy_foo
- provides :my_super_thingy, platform: 'foo'
+ provides :my_super_thingy, platform: "foo"
end
class MySuperThingyBar < BaseThingy
resource_name :my_super_thingy_bar
- provides :my_super_thingy, platform: 'bar'
+ provides :my_super_thingy, platform: "bar"
end
}
it "A run with platform 'foo' uses MySuperThingyFoo" do
r = Cheffish::ChefRun.new(chef_config)
- r.client.run_context.node.automatic['platform'] = 'foo'
+ r.client.run_context.node.automatic["platform"] = "foo"
r.compile_recipe {
- my_super_thingy 'blah' do; end
+ my_super_thingy "blah" do; end
}
r.converge
expect(r).to emit_no_warnings_or_errors
@@ -774,9 +774,9 @@ describe "Recipe DSL methods" do
it "A run with platform 'bar' uses MySuperThingyBar" do
r = Cheffish::ChefRun.new(chef_config)
- r.client.run_context.node.automatic['platform'] = 'bar'
+ r.client.run_context.node.automatic["platform"] = "bar"
r.compile_recipe {
- my_super_thingy 'blah' do; end
+ my_super_thingy "blah" do; end
}
r.converge
expect(r).to emit_no_warnings_or_errors
@@ -785,10 +785,10 @@ describe "Recipe DSL methods" do
it "A run with platform 'x' reports that my_super_thingy is not supported" do
r = Cheffish::ChefRun.new(chef_config)
- r.client.run_context.node.automatic['platform'] = 'x'
+ r.client.run_context.node.automatic["platform"] = "x"
expect {
r.compile_recipe {
- my_super_thingy 'blah' do; end
+ my_super_thingy "blah" do; end
}
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
@@ -819,7 +819,7 @@ describe "Recipe DSL methods" do
it "declaring a resource providing the same :thingy11 with os: 'linux' does not produce a warning" do
expect(Chef::Log).not_to receive(:warn)
class RecipeDSLSpecNamespace::Thingy11AlternateProvider < BaseThingy
- provides :thingy11, os: 'linux'
+ provides :thingy11, os: "linux"
end
end
end
@@ -859,7 +859,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_a
end
@@ -887,7 +887,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -905,7 +905,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -923,7 +923,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -944,7 +944,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -962,7 +962,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -987,7 +987,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -1036,7 +1036,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_a
end
end
@@ -1048,7 +1048,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1075,7 +1075,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1087,7 +1087,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_z
end
end
@@ -1104,7 +1104,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1118,7 +1118,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1136,7 +1136,7 @@ describe "Recipe DSL methods" do
def self.inspect; name.inspect; end
end
result.resource_name two_classes_one_dsl
- result.provides two_classes_one_dsl, os: 'blarghle'
+ result.provides two_classes_one_dsl, os: "blarghle"
result
}
before { resource_class_blarghle } # pull on it so it gets defined before the recipe runs
@@ -1145,10 +1145,10 @@ describe "Recipe DSL methods" do
two_classes_one_dsl = self.two_classes_one_dsl
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
+ run_context.node.automatic[:os] = "blarghle"
instance_eval("#{two_classes_one_dsl} 'blah' do; end")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_blarghle
end
@@ -1156,10 +1156,10 @@ describe "Recipe DSL methods" do
two_classes_one_dsl = self.two_classes_one_dsl
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
+ run_context.node.automatic[:os] = "linux"
instance_eval("#{two_classes_one_dsl} 'blah' do; end")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
end
@@ -1196,7 +1196,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{dsl_name} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
expect(resource_class.called_provides).to be_truthy
end
@@ -1264,7 +1264,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1291,7 +1291,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1308,7 +1308,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1337,7 +1337,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class2
end
end
@@ -1363,7 +1363,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
expect(provider_class.called_provides).to be_truthy
end
@@ -1484,7 +1484,7 @@ describe "Recipe DSL methods" do
it "looks up the provider in Chef::Provider converting the resource name from snake case to camel case" do
resource = nil
recipe = converge {
- resource = lw_resource_with_hw_provider_test_case 'blah' do; end
+ resource = lw_resource_with_hw_provider_test_case "blah" do; end
}
expect(resource.created_provider).to eq(Chef::Provider::LwResourceWithHwProviderTestCase)
end
diff --git a/spec/integration/recipes/remote_directory.rb b/spec/integration/recipes/remote_directory.rb
index a1988ccd52..77fe183136 100644
--- a/spec/integration/recipes/remote_directory.rb
+++ b/spec/integration/recipes/remote_directory.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe Chef::Resource::RemoteDirectory do
include IntegrationSupport
@@ -20,7 +20,7 @@ describe Chef::Resource::RemoteDirectory do
when_the_repository "has a cookbook with a source_dir with two subdirectories, each with one file and subdir in a different alphabetical order" do
before do
- file 'config/client.rb', <<-EOM
+ file "config/client.rb", <<-EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
diff --git a/spec/integration/recipes/resource_action_spec.rb b/spec/integration/recipes/resource_action_spec.rb
index 17a1eb9acd..b8c533b31d 100644
--- a/spec/integration/recipes/resource_action_spec.rb
+++ b/spec/integration/recipes/resource_action_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
# Houses any classes we declare
module ResourceActionSpec
@@ -36,7 +36,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_attribute
- expect(ActionJackson.succeeded).to eq 'foo!'
+ expect(ActionJackson.succeeded).to eq "foo!"
end
it "the action can access public methods" do
@@ -47,7 +47,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_method
- expect(ActionJackson.succeeded).to eq 'foo_public!'
+ expect(ActionJackson.succeeded).to eq "foo_public!"
end
it "the action can access protected methods" do
@@ -58,7 +58,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_protected_method
- expect(ActionJackson.succeeded).to eq 'foo_protected!'
+ expect(ActionJackson.succeeded).to eq "foo_protected!"
end
it "the action cannot access private methods" do
@@ -98,7 +98,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_class_method
- expect(ActionJackson.succeeded).to eq 'ruby_block_converged!'
+ expect(ActionJackson.succeeded).to eq "ruby_block_converged!"
end
it "the action's resources converge before the next resource converges" do
@@ -115,8 +115,8 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_attribute
- expect(ActionJackson.succeeded).to eq 'foo!'
- expect(ActionJackson.ruby_block_converged).to eq 'foo!'
+ expect(ActionJackson.succeeded).to eq "foo!"
+ expect(ActionJackson.ruby_block_converged).to eq "foo!"
end
end
@@ -140,21 +140,21 @@ describe "Resource.action" do
public
def foo_public
- 'foo_public!'
+ "foo_public!"
end
protected
def foo_protected
- 'foo_protected!'
+ "foo_protected!"
end
private
def foo_private
- 'foo_private!'
+ "foo_private!"
end
public
action :access_recipe_dsl do
ActionJackson.ran_action = :access_recipe_dsl
- ruby_block 'hi there' do
+ ruby_block "hi there" do
block do
ActionJackson.succeeded = true
end
@@ -205,7 +205,7 @@ describe "Resource.action" do
end
it "Can retrieve ancestors of action class without crashing" do
- converge { action_jackson 'hi' }
+ converge { action_jackson "hi" }
expect { ActionJackson.action_class.ancestors.join(",") }.not_to raise_error
end
@@ -260,9 +260,9 @@ describe "Resource.action" do
it "the default action remains the same even though new actions were specified first" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
end
}
expect(ActionJackson.ran_action).to eq :access_recipe_dsl
@@ -271,10 +271,10 @@ describe "Resource.action" do
it "new actions run, and can access overridden, new, and overridden attributes" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
- blarghle 'blarghle!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
+ blarghle "blarghle!"
action :access_jackalope
end
}
@@ -284,10 +284,10 @@ describe "Resource.action" do
it "overridden actions run, call super, and can access overridden, new, and overridden attributes" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
- blarghle 'blarghle!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
+ blarghle "blarghle!"
action :access_attribute
end
}
@@ -299,10 +299,10 @@ describe "Resource.action" do
it "non-overridden actions run and can access overridden and non-overridden variables (but not necessarily new ones)" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
- blarghle 'blarghle!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
+ blarghle "blarghle!"
action :access_attribute2
end
}
@@ -328,8 +328,8 @@ describe "Resource.action" do
it "the default action is :nothing" do
converge {
- no_action_jackson 'hi' do
- foo 'foo!'
+ no_action_jackson "hi" do
+ foo "foo!"
NoActionJackson.action_was = action
end
}
@@ -352,7 +352,7 @@ describe "Resource.action" do
it "Running the action works" do
expect_recipe {
- weird_action_jackson 'hi'
+ weird_action_jackson "hi"
}.to be_up_to_date
expect(WeirdActionJackson.action_was).to eq :"a-b-c d"
end
@@ -373,7 +373,7 @@ describe "Resource.action" do
resource_name :resource_action_spec_also_with_x
property :x
action :set_x_to_x do
- resource_action_spec_with_x 'hi' do
+ resource_action_spec_with_x "hi" do
x x
end
end
@@ -381,13 +381,13 @@ describe "Resource.action" do
__LINE__-4
end
action :set_x_to_x_in_non_initializer do
- r = resource_action_spec_with_x 'hi' do
+ r = resource_action_spec_with_x "hi" do
x 10
end
x_times_2 = r.x*2
end
action :set_x_to_10 do
- resource_action_spec_with_x 'hi' do
+ resource_action_spec_with_x "hi" do
x 10
end
end
@@ -397,7 +397,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to x emits a warning that you're using the wrong x" do
recipe = converge {
- resource_action_spec_also_with_x 'hi' do
+ resource_action_spec_also_with_x "hi" do
x 1
action :set_x_to_x
end
@@ -409,7 +409,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to x outside the initializer emits no warning" do
expect_recipe {
- resource_action_spec_also_with_x 'hi' do
+ resource_action_spec_also_with_x "hi" do
x 1
action :set_x_to_x_in_non_initializer
end
@@ -418,7 +418,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to 10 emits no warning" do
expect_recipe {
- resource_action_spec_also_with_x 'hi' do
+ resource_action_spec_also_with_x "hi" do
x 1
action :set_x_to_10
end
@@ -427,7 +427,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to 10 emits no warning" do
expect_recipe {
- r = resource_action_spec_also_with_x 'hi'
+ r = resource_action_spec_also_with_x "hi"
r.x 1
r.action :set_x_to_10
}.to emit_no_warnings_or_errors
@@ -442,14 +442,14 @@ describe "Resource.action" do
property :template
action :create do
template "x" do
- 'blah'
+ "blah"
end
end
end
it "Raises an error when attempting to use a template in the action" do
expect_converge {
- has_property_named_template 'hi'
+ has_property_named_template "hi"
}.to raise_error(/Property template of has_property_named_template\[hi\] cannot be passed a block! If you meant to create a resource named template instead, you'll need to first rename the property./)
end
end
@@ -484,16 +484,16 @@ describe "Resource.action" do
end
it "the methods are not available on the resource" do
- expect { DeclaresActionClassMethods.new('hi').a }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').b }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').c }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').d }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").a }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").b }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").c }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").d }.to raise_error(NameError)
end
it "the methods are available to the action" do
r = nil
expect_recipe {
- r = declares_action_class_methods 'hi'
+ r = declares_action_class_methods "hi"
}.to emit_no_warnings_or_errors
expect(r.x).to eq(10)
end
@@ -512,17 +512,17 @@ describe "Resource.action" do
end
it "the methods are not available on the resource" do
- expect { DeclaresActionClassMethods.new('hi').a }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').b }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').c }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').d }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').e }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").a }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").b }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").c }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").d }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").e }.to raise_error(NameError)
end
it "the methods are available to the action" do
r = nil
expect_recipe {
- r = declares_action_class_methods_too 'hi'
+ r = declares_action_class_methods_too "hi"
}.to emit_no_warnings_or_errors
expect(r.x).to eq(15)
end
diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb
index f3b562c50d..2bcccd9831 100644
--- a/spec/integration/recipes/resource_converge_if_changed_spec.rb
+++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Resource::ActionClass#converge_if_changed" do
include IntegrationSupport
@@ -23,10 +23,10 @@ describe "Resource::ActionClass#converge_if_changed" do
result = Class.new(Chef::Resource) do
def self.to_s; resource_name; end
def self.inspect; resource_name.inspect; end
- property :identity1, identity: true, default: 'default_identity1'
- property :control1, desired_state: false, default: 'default_control1'
- property :state1, default: 'default_state1'
- property :state2, default: 'default_state2'
+ property :identity1, identity: true, default: "default_identity1"
+ property :control1, desired_state: false, default: "default_control1"
+ property :state1, default: "default_state1"
+ property :state2, default: "default_state2"
attr_accessor :converged
def initialize(*args)
super
@@ -51,8 +51,8 @@ describe "Resource::ActionClass#converge_if_changed" do
context "and current_resource with state1=current, state2=current" do
before :each do
resource_class.load_current_value do
- state1 'current_state1'
- state2 'current_state2'
+ state1 "current_state1"
+ state2 "current_state2"
end
end
@@ -198,8 +198,8 @@ EOM
context "and current_resource with identity1=current, control1=current" do
before :each do
resource_class.load_current_value do
- identity1 'current_identity1'
- control1 'current_control1'
+ identity1 "current_identity1"
+ control1 "current_control1"
end
end
@@ -314,8 +314,8 @@ EOM
context "and current_resource with state1=current, state2=current" do
before :each do
resource_class.load_current_value do
- state1 'current_state1'
- state2 'current_state2'
+ state1 "current_state1"
+ state2 "current_state2"
end
end
diff --git a/spec/integration/recipes/resource_load_spec.rb b/spec/integration/recipes/resource_load_spec.rb
index 556201efd8..66a36b1431 100644
--- a/spec/integration/recipes/resource_load_spec.rb
+++ b/spec/integration/recipes/resource_load_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Resource.load_current_value" do
include IntegrationSupport
@@ -55,29 +55,29 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge {
- r = public_send(e.resource_name, 'blah') do
- x 'desired'
+ r = public_send(e.resource_name, "blah") do
+ x "desired"
end
}
r
end
it "current_resource is passed name but not x" do
- expect(resource.current_value.x).to eq 'loaded 2 (name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (name=blah)"
end
it "resource.current_value returns a different resource" do
- expect(resource.current_value.x).to eq 'loaded 2 (name=blah)'
- expect(resource.x).to eq 'desired'
+ expect(resource.current_value.x).to eq "loaded 2 (name=blah)"
+ expect(resource.x).to eq "desired"
end
it "resource.current_value constructs the resource anew each time" do
- expect(resource.current_value.x).to eq 'loaded 2 (name=blah)'
- expect(resource.current_value.x).to eq 'loaded 3 (name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (name=blah)"
+ expect(resource.current_value.x).to eq "loaded 3 (name=blah)"
end
it "the provider accesses the current value of x" do
- expect(resource.class.created_x).to eq 'desired'
+ expect(resource.class.created_x).to eq "desired"
end
context "and identity: :i and :d with desired_state: false" do
@@ -89,12 +89,12 @@ describe "Resource.load_current_value" do
}
before {
- resource.i 'desired_i'
- resource.d 'desired_d'
+ resource.i "desired_i"
+ resource.d "desired_d"
}
it "i, name and d are passed to load_current_value, but not x" do
- expect(resource.current_value.x).to eq 'loaded 2 (d=desired_d, i=desired_i, name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (d=desired_d, i=desired_i, name=blah)"
end
end
@@ -107,12 +107,12 @@ describe "Resource.load_current_value" do
}
before {
- resource.i 'desired_i'
- resource.d 'desired_d'
+ resource.i "desired_i"
+ resource.d "desired_d"
}
it "i, name and d are passed to load_current_value, but not x" do
- expect(resource.current_value.x).to eq 'loaded 2 (d=desired_d, i=desired_i, name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (d=desired_d, i=desired_i, name=blah)"
end
end
end
@@ -122,14 +122,14 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge {
- r = public_send(e.resource_name, 'blah') do
+ r = public_send(e.resource_name, "blah") do
end
}
r
end
it "the provider accesses values from load_current_value" do
- expect(resource.class.created_x).to eq 'loaded 1 (name=blah)'
+ expect(resource.class.created_x).to eq "loaded 1 (name=blah)"
end
end
@@ -151,8 +151,8 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge {
- r = public_send(e.subresource_name, 'blah') do
- x 'desired'
+ r = public_send(e.subresource_name, "blah") do
+ x "desired"
end
}
r
@@ -160,7 +160,7 @@ describe "Resource.load_current_value" do
context "and a child resource class with no load_current_value" do
it "the parent load_current_value is used" do
- expect(subresource.current_value.x).to eq 'loaded 2 (name=blah)'
+ expect(subresource.current_value.x).to eq "loaded 2 (name=blah)"
end
it "load_current_value yields a copy of the child class" do
expect(subresource.current_value).to be_kind_of(subresource_class)
@@ -179,8 +179,8 @@ describe "Resource.load_current_value" do
it "the overridden load_current_value is used" do
current_resource = subresource.current_value
- expect(current_resource.x).to eq 'default 3'
- expect(current_resource.y).to eq 'loaded_y 2 (name=blah)'
+ expect(current_resource.x).to eq "default 3"
+ expect(current_resource.y).to eq "loaded_y 2 (name=blah)"
end
end
@@ -197,8 +197,8 @@ describe "Resource.load_current_value" do
it "the original load_current_value is called as well as the child one" do
current_resource = subresource.current_value
- expect(current_resource.x).to eq 'loaded 3 (name=blah)'
- expect(current_resource.y).to eq 'loaded_y 4 (name=blah, x=loaded 3 (name=blah))'
+ expect(current_resource.x).to eq "loaded 3 (name=blah)"
+ expect(current_resource.y).to eq "loaded_y 4 (name=blah, x=loaded 3 (name=blah))"
end
end
end
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 6240a38144..4849cb4d40 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -1,9 +1,9 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
-require 'chef/run_lock'
-require 'chef/config'
-require 'timeout'
-require 'fileutils'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
+require "chef/run_lock"
+require "chef/config"
+require "timeout"
+require "fileutils"
describe "chef-solo" do
include IntegrationSupport
@@ -19,12 +19,12 @@ describe "chef-solo" do
when_the_repository "has a cookbook with a basic recipe" do
before do
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
end
it "should complete with success" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -34,12 +34,12 @@ EOM
end
it "should evaluate its node.json file" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
- file 'config/node.json',<<-E
+ file "config/node.json",<<-E
{"run_list":["x::default"]}
E
@@ -52,15 +52,15 @@ E
when_the_repository "has a cookbook with an undeclared dependency" do
before do
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'cookbooks/x/recipes/default.rb', 'include_recipe "ancient::aliens"'
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "cookbooks/x/recipes/default.rb", 'include_recipe "ancient::aliens"'
- file 'cookbooks/ancient/metadata.rb', cookbook_ancient_100_metadata_rb
- file 'cookbooks/ancient/recipes/aliens.rb', 'print "it was aliens"'
+ file "cookbooks/ancient/metadata.rb", cookbook_ancient_100_metadata_rb
+ file "cookbooks/ancient/recipes/aliens.rb", 'print "it was aliens"'
end
it "should exit with an error" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -72,9 +72,9 @@ EOM
when_the_repository "has a cookbook with an incompatible chef_version" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
- file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
- file 'config/solo.rb', <<EOM
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
+ file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -89,9 +89,9 @@ EOM
when_the_repository "has a cookbook with an incompatible ohai_version" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nohai_version '~> 999.0'")
- file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
- file 'config/solo.rb', <<EOM
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nohai_version '~> 999.0'")
+ file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -107,10 +107,10 @@ EOM
when_the_repository "has a cookbook with a recipe with sleep" do
before do
- directory 'logs'
- file 'logs/runs.log', ''
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'cookbooks/x/recipes/default.rb', <<EOM
+ directory "logs"
+ file "logs/runs.log", ""
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "cookbooks/x/recipes/default.rb", <<EOM
ruby_block "sleeping" do
block do
sleep 5
@@ -120,7 +120,7 @@ EOM
end
it "while running solo concurrently" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -149,7 +149,7 @@ EOM
# Unfortunately file / directory helpers in integration tests
# are implemented using before(:each) so we need to do all below
# checks in one example.
- run_log = File.read(path_to('logs/runs.log'))
+ run_log = File.read(path_to("logs/runs.log"))
# both of the runs should succeed
expect(run_log.lines.reject {|l| !l.include? "INFO: Chef Run complete in"}.length).to eq(2)