chef 12.0.3-x86-mingw32 → 12.1.0.rc.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +4 -1
- data/README.md +42 -18
- data/distro/common/html/_sources/ctl_chef_client.txt +1 -1
- data/distro/common/html/_sources/ctl_chef_server.txt +53 -35
- data/distro/common/html/_sources/ctl_chef_solo.txt +1 -1
- data/distro/common/html/_sources/knife_bootstrap.txt +1 -1
- data/distro/common/html/_sources/knife_cookbook_site.txt +1 -1
- data/distro/common/html/_sources/knife_data_bag.txt +4 -4
- data/distro/common/html/_sources/knife_status.txt +1 -1
- data/distro/common/html/_static/searchtools.js +1 -1
- data/distro/common/html/ctl_chef_client.html +55 -7
- data/distro/common/html/ctl_chef_server.html +84 -41
- data/distro/common/html/ctl_chef_shell.html +45 -1
- data/distro/common/html/ctl_chef_solo.html +51 -5
- data/distro/common/html/index.html +2 -2
- data/distro/common/html/knife.html +1 -1
- data/distro/common/html/knife_bootstrap.html +30 -10
- data/distro/common/html/knife_cookbook_site.html +2 -0
- data/distro/common/html/knife_data_bag.html +4 -4
- data/distro/common/html/knife_node.html +2 -2
- data/distro/common/html/knife_raw.html +1 -1
- data/distro/common/html/knife_role.html +1 -1
- data/distro/common/html/knife_search.html +3 -3
- data/distro/common/html/knife_status.html +4 -0
- data/distro/common/html/searchindex.js +1 -1
- data/distro/common/man/man1/chef-shell.1 +72 -1
- data/distro/common/man/man1/knife-bootstrap.1 +71 -63
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +4 -1
- data/distro/common/man/man1/knife-cookbook.1 +1 -1
- data/distro/common/man/man1/knife-data-bag.1 +5 -5
- data/distro/common/man/man1/knife-delete.1 +1 -1
- data/distro/common/man/man1/knife-deps.1 +1 -1
- data/distro/common/man/man1/knife-diff.1 +1 -1
- data/distro/common/man/man1/knife-download.1 +1 -1
- data/distro/common/man/man1/knife-edit.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +1 -1
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index-rebuild.1 +1 -1
- data/distro/common/man/man1/knife-list.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +3 -3
- data/distro/common/man/man1/knife-raw.1 +2 -2
- data/distro/common/man/man1/knife-recipe-list.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +2 -2
- data/distro/common/man/man1/knife-search.1 +4 -4
- data/distro/common/man/man1/knife-serve.1 +1 -1
- data/distro/common/man/man1/knife-show.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-ssl-check.1 +1 -1
- data/distro/common/man/man1/knife-ssl-fetch.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife-upload.1 +1 -1
- data/distro/common/man/man1/knife-user.1 +1 -1
- data/distro/common/man/man1/knife-xargs.1 +1 -1
- data/distro/common/man/man1/knife.1 +1 -1
- data/distro/common/man/man8/chef-apply.8 +86 -0
- data/distro/common/man/man8/chef-client.8 +76 -5
- data/distro/common/man/man8/chef-solo.8 +79 -6
- data/distro/common/markdown/man1/knife-bootstrap.mkd +1 -1
- data/distro/common/markdown/man1/knife-cookbook-site.mkd +1 -1
- data/distro/common/markdown/man1/knife-data-bag.mkd +1 -1
- data/distro/common/markdown/man1/knife-environment.mkd +1 -1
- data/distro/common/markdown/man1/knife.mkd +1 -1
- data/lib/chef.rb +0 -7
- data/lib/chef/api_client.rb +10 -2
- data/lib/chef/api_client/registration.rb +7 -9
- data/lib/chef/application.rb +28 -12
- data/lib/chef/application/apply.rb +17 -1
- data/lib/chef/application/client.rb +74 -6
- data/lib/chef/application/knife.rb +1 -2
- data/lib/chef/application/solo.rb +30 -0
- data/lib/chef/application/windows_service.rb +1 -0
- data/lib/chef/application/windows_service_manager.rb +8 -2
- data/lib/chef/applications.rb +0 -1
- data/lib/chef/audit/audit_event_proxy.rb +93 -0
- data/lib/chef/audit/audit_reporter.rb +169 -0
- data/lib/chef/audit/control_group_data.rb +140 -0
- data/lib/chef/audit/rspec_formatter.rb +37 -0
- data/lib/chef/audit/runner.rb +178 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +11 -2
- data/lib/chef/chef_fs/config.rb +25 -4
- data/lib/chef/chef_fs/data_handler/policy_data_handler.rb +15 -0
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -0
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +5 -0
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_entry.rb +3 -2
- data/lib/chef/{shef/ext.rb → chef_fs/file_system/chef_repository_file_system_policies_dir.rb} +22 -3
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +4 -0
- data/lib/chef/client.rb +81 -52
- data/lib/chef/config.rb +35 -3
- data/lib/chef/cookbook/metadata.rb +3 -3
- data/lib/chef/cookbook_manifest.rb +275 -0
- data/lib/chef/cookbook_site_streaming_uploader.rb +24 -23
- data/lib/chef/cookbook_uploader.rb +11 -2
- data/lib/chef/cookbook_version.rb +71 -194
- data/lib/chef/data_bag.rb +5 -2
- data/lib/chef/data_bag_item.rb +6 -3
- data/lib/chef/deprecation/warnings.rb +5 -4
- data/lib/chef/dsl/audit.rb +51 -0
- data/lib/chef/dsl/include_recipe.rb +2 -3
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/recipe.rb +49 -31
- data/lib/chef/encrypted_data_bag_item/assertions.rb +0 -3
- data/lib/chef/environment.rb +5 -2
- data/lib/chef/event_dispatch/base.rb +36 -1
- data/lib/chef/event_dispatch/dispatcher.rb +3 -5
- data/lib/chef/exceptions.rb +61 -2
- data/lib/chef/file_access_control/unix.rb +12 -0
- data/lib/chef/file_access_control/windows.rb +14 -0
- data/lib/chef/formatters/doc.rb +47 -1
- data/{spec/unit/monkey_patches/string_spec.rb → lib/chef/guard_interpreter.rb} +11 -16
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +3 -2
- data/lib/chef/http.rb +1 -2
- data/lib/chef/knife.rb +5 -3
- data/lib/chef/knife/bootstrap.rb +84 -15
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +165 -0
- data/lib/chef/knife/bootstrap/client_builder.rb +190 -0
- data/lib/chef/knife/bootstrap/{README.md → templates/README.md} +0 -0
- data/lib/chef/knife/bootstrap/{archlinux-gems.erb → templates/archlinux-gems.erb} +9 -0
- data/lib/chef/knife/bootstrap/{chef-aix.erb → templates/chef-aix.erb} +9 -0
- data/lib/chef/knife/bootstrap/{chef-full.erb → templates/chef-full.erb} +10 -1
- data/lib/chef/knife/client_create.rb +8 -7
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +1 -1
- data/lib/chef/knife/cookbook_site_list.rb +1 -1
- data/lib/chef/knife/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +39 -28
- data/lib/chef/knife/cookbook_site_show.rb +3 -3
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
- data/lib/chef/knife/cookbook_test.rb +1 -0
- data/lib/chef/knife/cookbook_upload.rb +13 -8
- data/lib/chef/knife/core/bootstrap_context.rb +14 -3
- data/lib/chef/knife/core/generic_presenter.rb +5 -2
- data/lib/chef/knife/core/object_loader.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +24 -0
- data/lib/chef/knife/core/ui.rb +9 -1
- data/lib/chef/knife/node_run_list_remove.rb +11 -3
- data/lib/chef/knife/raw.rb +14 -3
- data/lib/chef/knife/role_env_run_list_add.rb +86 -0
- data/lib/chef/knife/role_env_run_list_clear.rb +55 -0
- data/lib/chef/knife/role_env_run_list_remove.rb +57 -0
- data/lib/chef/knife/role_env_run_list_replace.rb +59 -0
- data/lib/chef/knife/role_env_run_list_set.rb +70 -0
- data/lib/chef/knife/role_run_list_add.rb +86 -0
- data/lib/chef/knife/role_run_list_clear.rb +55 -0
- data/lib/chef/knife/role_run_list_remove.rb +57 -0
- data/lib/chef/knife/role_run_list_replace.rb +59 -0
- data/lib/chef/knife/role_run_list_set.rb +70 -0
- data/lib/chef/knife/search.rb +4 -4
- data/lib/chef/knife/serve.rb +3 -0
- data/lib/chef/knife/ssh.rb +1 -1
- data/lib/chef/knife/ssl_check.rb +2 -2
- data/lib/chef/knife/ssl_fetch.rb +14 -1
- data/lib/chef/log.rb +10 -1
- data/lib/chef/mixin/command.rb +1 -1
- data/lib/chef/mixin/command/windows.rb +1 -5
- data/lib/chef/mixin/get_source_from_package.rb +1 -0
- data/lib/chef/mixin/params_validate.rb +2 -2
- data/lib/chef/mixin/securable.rb +1 -7
- data/lib/chef/mixin/shell_out.rb +7 -1
- data/lib/chef/mixin/template.rb +2 -14
- data/lib/chef/mixin/why_run.rb +1 -1
- data/lib/chef/monkey_patches/net_http.rb +4 -0
- data/lib/chef/monologger.rb +0 -2
- data/lib/chef/node.rb +5 -2
- data/lib/chef/node/attribute.rb +11 -9
- data/lib/chef/node/attribute_collections.rb +8 -12
- data/lib/chef/node/immutable_collections.rb +4 -10
- data/lib/chef/org.rb +148 -0
- data/lib/chef/platform/provider_mapping.rb +3 -2
- data/lib/chef/platform/provider_priority_map.rb +2 -0
- data/lib/chef/platform/query_helpers.rb +0 -3
- data/lib/chef/policy_builder/policyfile.rb +51 -8
- data/lib/chef/provider/deploy.rb +1 -2
- data/lib/chef/provider/directory.rb +3 -3
- data/lib/chef/provider/dsc_script.rb +13 -7
- data/lib/chef/provider/env.rb +8 -8
- data/lib/chef/provider/execute.rb +55 -36
- data/lib/chef/provider/file.rb +8 -0
- data/lib/chef/provider/group.rb +2 -0
- data/lib/chef/provider/group/dscl.rb +3 -4
- data/lib/chef/provider/ifconfig.rb +25 -25
- data/lib/chef/provider/ifconfig/aix.rb +25 -27
- data/lib/chef/provider/lwrp_base.rb +1 -1
- data/lib/chef/provider/mount.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +3 -4
- data/lib/chef/provider/mount/solaris.rb +1 -1
- data/lib/chef/provider/package.rb +297 -48
- data/lib/chef/provider/package/aix.rb +25 -30
- data/lib/chef/provider/package/apt.rb +63 -19
- data/lib/chef/provider/package/dpkg.rb +15 -16
- data/lib/chef/provider/package/macports.rb +7 -7
- data/lib/chef/provider/package/openbsd.rb +107 -0
- data/lib/chef/provider/package/pacman.rb +13 -15
- data/lib/chef/provider/package/portage.rb +3 -4
- data/lib/chef/provider/package/rpm.rb +28 -17
- data/lib/chef/provider/package/rubygems.rb +9 -9
- data/lib/chef/provider/package/solaris.rb +17 -21
- data/lib/chef/provider/package/windows/msi.rb +1 -1
- data/lib/chef/provider/package/yum-dump.py +2 -2
- data/lib/chef/provider/package/yum.rb +117 -51
- data/lib/chef/provider/package/zypper.rb +17 -18
- data/lib/chef/provider/powershell_script.rb +4 -4
- data/lib/chef/provider/registry_key.rb +2 -2
- data/lib/chef/provider/remote_directory.rb +1 -1
- data/lib/chef/provider/script.rb +25 -16
- data/lib/chef/provider/service.rb +1 -1
- data/lib/chef/provider/service/freebsd.rb +1 -1
- data/lib/chef/provider/service/openbsd.rb +216 -0
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/service/windows.rb +99 -1
- data/lib/chef/provider/user.rb +1 -1
- data/lib/chef/provider/user/dscl.rb +19 -4
- data/lib/chef/providers.rb +2 -0
- data/lib/chef/recipe.rb +11 -5
- data/lib/chef/request_id.rb +1 -1
- data/lib/chef/resource.rb +839 -444
- data/lib/chef/resource/chef_gem.rb +20 -3
- data/lib/chef/resource/conditional.rb +3 -14
- data/lib/chef/resource/dsc_script.rb +14 -0
- data/lib/chef/resource/execute.rb +14 -7
- data/lib/chef/resource/file.rb +14 -0
- data/lib/chef/resource/file/verification.rb +122 -0
- data/lib/chef/resource/ips_package.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +2 -11
- data/lib/chef/resource/macports_package.rb +2 -1
- data/lib/chef/resource/openbsd_package.rb +51 -0
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/paludis_package.rb +1 -1
- data/lib/chef/resource/reboot.rb +1 -1
- data/lib/chef/resource/remote_file.rb +1 -0
- data/lib/chef/resource/rpm_package.rb +9 -0
- data/lib/chef/resource/script.rb +11 -0
- data/lib/chef/resource/template.rb +2 -3
- data/lib/chef/resource/windows_package.rb +1 -1
- data/lib/chef/resource/windows_service.rb +18 -0
- data/lib/chef/resource_builder.rb +137 -0
- data/lib/chef/resource_definition.rb +1 -1
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/role.rb +17 -4
- data/lib/chef/run_context.rb +10 -6
- data/lib/chef/search/query.rb +66 -87
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/util/diff.rb +1 -4
- data/lib/chef/util/dsc/configuration_generator.rb +30 -6
- data/lib/chef/util/dsc/lcm_output_parser.rb +7 -3
- data/lib/chef/util/dsc/local_configuration_manager.rb +8 -8
- data/lib/chef/util/file_edit.rb +2 -2
- data/lib/chef/util/path_helper.rb +1 -4
- data/lib/chef/util/windows/net_use.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +1 -0
- data/lib/chef/win32/api/security.rb +26 -0
- data/lib/chef/win32/file.rb +21 -0
- data/lib/chef/win32/security.rb +46 -0
- data/lib/chef/win32/security/token.rb +8 -0
- data/lib/chef/win32/version.rb +0 -4
- data/spec/data/recipes.tgz +0 -0
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/audit/rspec_formatter_spec.rb +54 -0
- data/spec/functional/audit/runner_spec.rb +137 -0
- data/spec/functional/dsl/reboot_pending_spec.rb +10 -10
- data/spec/functional/dsl/registry_helper_spec.rb +6 -6
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +5 -5
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +12 -21
- data/spec/functional/http/simple_spec.rb +1 -1
- data/spec/functional/knife/cookbook_delete_spec.rb +24 -24
- data/spec/functional/knife/exec_spec.rb +2 -4
- data/spec/functional/knife/smoke_test.rb +1 -1
- data/spec/functional/knife/ssh_spec.rb +23 -23
- data/spec/functional/provider/remote_file/cache_control_data_spec.rb +8 -8
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/functional/rebooter_spec.rb +1 -1
- data/spec/functional/resource/aix_service_spec.rb +3 -0
- data/spec/functional/resource/aixinit_service_spec.rb +3 -3
- data/spec/functional/resource/bash_spec.rb +88 -0
- data/spec/functional/resource/deploy_revision_spec.rb +99 -100
- data/spec/functional/resource/env_spec.rb +3 -3
- data/spec/functional/resource/execute_spec.rb +97 -63
- data/spec/functional/resource/file_spec.rb +7 -7
- data/spec/functional/resource/git_spec.rb +13 -13
- data/spec/functional/resource/group_spec.rb +28 -25
- data/spec/functional/resource/ifconfig_spec.rb +2 -2
- data/spec/functional/resource/link_spec.rb +77 -78
- data/spec/functional/resource/mount_spec.rb +5 -5
- data/spec/functional/resource/ohai_spec.rb +1 -1
- data/spec/functional/resource/package_spec.rb +22 -22
- data/spec/functional/resource/powershell_spec.rb +57 -42
- data/spec/functional/resource/reboot_spec.rb +2 -2
- data/spec/functional/resource/registry_spec.rb +91 -91
- data/spec/functional/resource/remote_directory_spec.rb +19 -19
- data/spec/functional/resource/remote_file_spec.rb +18 -18
- data/spec/functional/resource/template_spec.rb +4 -4
- data/spec/functional/resource/user/dscl_spec.rb +4 -4
- data/spec/functional/resource/user/useradd_spec.rb +64 -51
- data/spec/functional/resource/windows_service_spec.rb +98 -0
- data/spec/functional/run_lock_spec.rb +9 -9
- data/spec/functional/shell_spec.rb +3 -3
- data/spec/functional/tiny_server_spec.rb +12 -12
- data/spec/functional/util/path_helper_spec.rb +1 -1
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/registry_helper_spec.rb +125 -125
- data/spec/functional/win32/security_spec.rb +65 -2
- data/spec/functional/win32/service_manager_spec.rb +30 -84
- data/spec/functional/win32/versions_spec.rb +6 -6
- data/spec/integration/client/client_spec.rb +102 -9
- data/spec/integration/knife/chef_fs_data_store_spec.rb +12 -8
- data/spec/integration/knife/common_options_spec.rb +3 -3
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +2 -2
- data/spec/integration/knife/deps_spec.rb +4 -4
- data/spec/integration/knife/diff_spec.rb +6 -6
- data/spec/integration/knife/download_spec.rb +6 -6
- data/spec/integration/knife/list_spec.rb +2 -2
- data/spec/integration/knife/raw_spec.rb +5 -5
- data/spec/integration/knife/serve_spec.rb +3 -3
- data/spec/integration/knife/show_spec.rb +3 -3
- data/spec/integration/knife/upload_spec.rb +18 -18
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/integration/solo/solo_spec.rb +11 -12
- data/spec/spec_helper.rb +27 -15
- data/spec/stress/win32/file_spec.rb +4 -4
- data/spec/stress/win32/security_spec.rb +4 -4
- data/spec/support/chef_helpers.rb +3 -3
- data/spec/support/matchers/leak.rb +2 -2
- data/spec/support/mock/platform.rb +1 -1
- data/spec/support/pedant/Gemfile +3 -0
- data/spec/support/pedant/pedant_config.rb +9 -2
- data/spec/support/pedant/run_pedant.rb +15 -16
- data/spec/support/platform_helpers.rb +8 -12
- data/spec/support/shared/functional/directory_resource.rb +13 -13
- data/spec/support/shared/functional/file_resource.rb +83 -83
- data/spec/support/shared/functional/http.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +64 -64
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +43 -41
- data/spec/support/shared/functional/win32_service.rb +60 -0
- data/spec/support/shared/functional/windows_script.rb +8 -8
- data/spec/support/shared/integration/knife_support.rb +8 -5
- data/spec/support/shared/matchers/exit_with_code.rb +6 -2
- data/spec/support/shared/unit/api_error_inspector.rb +8 -8
- data/spec/support/shared/unit/execute_resource.rb +24 -20
- data/spec/support/shared/unit/file_system_support.rb +2 -2
- data/spec/support/shared/unit/platform_introspector.rb +21 -21
- data/spec/support/shared/unit/provider/file.rb +239 -210
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +69 -69
- data/spec/support/shared/unit/script_resource.rb +40 -32
- data/spec/support/shared/unit/windows_script_resource.rb +8 -8
- data/spec/unit/api_client/registration_spec.rb +47 -47
- data/spec/unit/api_client_spec.rb +107 -69
- data/spec/unit/application/apply_spec.rb +31 -15
- data/spec/unit/application/client_spec.rb +146 -45
- data/spec/unit/application/knife_spec.rb +31 -31
- data/spec/unit/application/solo_spec.rb +59 -43
- data/spec/unit/application_spec.rb +109 -74
- data/spec/unit/audit/audit_event_proxy_spec.rb +311 -0
- data/spec/unit/audit/audit_reporter_spec.rb +393 -0
- data/spec/unit/audit/control_group_data_spec.rb +478 -0
- data/{lib/chef/monkey_patches/file.rb → spec/unit/audit/rspec_formatter_spec.rb} +11 -8
- data/spec/unit/audit/runner_spec.rb +135 -0
- data/spec/unit/chef_fs/config_spec.rb +52 -0
- data/spec/unit/chef_fs/diff_spec.rb +12 -12
- data/spec/unit/chef_fs/file_pattern_spec.rb +276 -277
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +6 -6
- data/spec/unit/chef_fs/file_system_spec.rb +26 -13
- data/spec/unit/chef_fs/parallelizer.rb +87 -87
- data/spec/unit/chef_spec.rb +1 -1
- data/spec/unit/client_spec.rb +263 -97
- data/spec/unit/config_fetcher_spec.rb +13 -13
- data/spec/unit/config_spec.rb +105 -66
- data/spec/unit/cookbook/chefignore_spec.rb +6 -6
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +3 -3
- data/spec/unit/cookbook/metadata_spec.rb +149 -149
- data/spec/unit/cookbook/syntax_check_spec.rb +36 -31
- data/spec/unit/cookbook_loader_spec.rb +62 -58
- data/spec/unit/cookbook_manifest_spec.rb +141 -468
- data/spec/unit/cookbook_site_streaming_uploader_spec.rb +27 -27
- data/spec/unit/cookbook_spec.rb +15 -15
- data/spec/unit/cookbook_uploader_spec.rb +37 -3
- data/spec/unit/cookbook_version_file_specificity_spec.rb +554 -0
- data/spec/unit/cookbook_version_spec.rb +98 -240
- data/spec/unit/daemon_spec.rb +31 -31
- data/spec/unit/data_bag_item_spec.rb +121 -89
- data/spec/unit/data_bag_spec.rb +35 -35
- data/spec/unit/deprecation_spec.rb +27 -14
- data/spec/unit/digester_spec.rb +3 -3
- data/spec/unit/dsl/audit_spec.rb +43 -0
- data/spec/unit/dsl/data_query_spec.rb +1 -1
- data/spec/unit/dsl/platform_introspection_spec.rb +14 -14
- data/spec/unit/dsl/reboot_pending_spec.rb +18 -18
- data/spec/unit/dsl/regsitry_helper_spec.rb +6 -6
- data/spec/unit/encrypted_data_bag_item_spec.rb +58 -82
- data/spec/unit/environment_spec.rb +105 -105
- data/spec/unit/exceptions_spec.rb +47 -1
- data/spec/unit/file_access_control_spec.rb +62 -56
- data/spec/unit/file_cache_spec.rb +11 -11
- data/spec/unit/file_content_management/deploy/cp_spec.rb +2 -2
- data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +10 -10
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +23 -23
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +14 -14
- data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +12 -12
- data/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +16 -16
- data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +4 -4
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +103 -13
- data/spec/unit/guard_interpreter_spec.rb +41 -0
- data/spec/unit/handler/json_file_spec.rb +10 -10
- data/spec/unit/handler_spec.rb +39 -39
- data/spec/unit/http/basic_client_spec.rb +3 -3
- data/spec/unit/http/http_request_spec.rb +10 -10
- data/spec/unit/http/simple_spec.rb +3 -3
- data/spec/unit/http/ssl_policies_spec.rb +15 -15
- data/spec/unit/http/validate_content_length_spec.rb +18 -13
- data/spec/unit/http_spec.rb +16 -9
- data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +153 -0
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +178 -0
- data/spec/unit/knife/bootstrap_spec.rb +144 -91
- data/spec/unit/knife/client_bulk_delete_spec.rb +24 -24
- data/spec/unit/knife/client_create_spec.rb +57 -43
- data/spec/unit/knife/client_delete_spec.rb +15 -15
- data/spec/unit/knife/client_edit_spec.rb +4 -4
- data/spec/unit/knife/client_list_spec.rb +2 -2
- data/spec/unit/knife/client_reregister_spec.rb +9 -9
- data/spec/unit/knife/configure_client_spec.rb +20 -20
- data/spec/unit/knife/configure_spec.rb +85 -85
- data/spec/unit/knife/cookbook_bulk_delete_spec.rb +15 -15
- data/spec/unit/knife/cookbook_create_spec.rb +59 -59
- data/spec/unit/knife/cookbook_delete_spec.rb +49 -49
- data/spec/unit/knife/cookbook_download_spec.rb +56 -56
- data/spec/unit/knife/cookbook_list_spec.rb +9 -9
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +8 -8
- data/spec/unit/knife/cookbook_metadata_spec.rb +44 -44
- data/spec/unit/knife/cookbook_show_spec.rb +29 -29
- data/spec/unit/knife/cookbook_site_download_spec.rb +26 -26
- data/spec/unit/knife/cookbook_site_install_spec.rb +5 -1
- data/spec/unit/knife/cookbook_site_share_spec.rb +68 -59
- data/spec/unit/knife/cookbook_site_unshare_spec.rb +15 -15
- data/spec/unit/knife/cookbook_test_spec.rb +16 -16
- data/spec/unit/knife/cookbook_upload_spec.rb +105 -71
- data/spec/unit/knife/core/bootstrap_context_spec.rb +37 -22
- data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +36 -36
- data/spec/unit/knife/core/object_loader_spec.rb +3 -3
- data/spec/unit/knife/core/subcommand_loader_spec.rb +107 -33
- data/spec/unit/knife/core/ui_spec.rb +84 -72
- data/spec/unit/knife/data_bag_from_file_spec.rb +1 -1
- data/spec/unit/knife/environment_compare_spec.rb +12 -12
- data/spec/unit/knife/environment_create_spec.rb +16 -16
- data/spec/unit/knife/environment_delete_spec.rb +14 -14
- data/spec/unit/knife/environment_edit_spec.rb +15 -15
- data/spec/unit/knife/environment_from_file_spec.rb +17 -17
- data/spec/unit/knife/environment_list_spec.rb +7 -7
- data/spec/unit/knife/environment_show_spec.rb +10 -10
- data/spec/unit/knife/index_rebuild_spec.rb +17 -17
- data/spec/unit/knife/knife_help.rb +24 -24
- data/spec/unit/knife/node_bulk_delete_spec.rb +14 -14
- data/spec/unit/knife/node_delete_spec.rb +11 -11
- data/spec/unit/knife/node_edit_spec.rb +17 -17
- data/spec/unit/knife/node_environment_set_spec.rb +12 -12
- data/spec/unit/knife/node_from_file_spec.rb +8 -8
- data/spec/unit/knife/node_list_spec.rb +9 -9
- data/spec/unit/knife/node_run_list_add_spec.rb +29 -29
- data/spec/unit/knife/node_run_list_remove_spec.rb +28 -13
- data/spec/unit/knife/node_run_list_set_spec.rb +27 -27
- data/spec/unit/knife/raw_spec.rb +43 -0
- data/spec/unit/knife/role_bulk_delete_spec.rb +12 -12
- data/spec/unit/knife/role_create_spec.rb +12 -12
- data/spec/unit/knife/role_delete_spec.rb +10 -10
- data/spec/unit/knife/role_edit_spec.rb +13 -13
- data/spec/unit/knife/role_env_run_list_add_spec.rb +217 -0
- data/spec/unit/knife/role_env_run_list_clear_spec.rb +100 -0
- data/spec/unit/knife/role_env_run_list_remove_spec.rb +108 -0
- data/spec/unit/knife/role_env_run_list_replace_spec.rb +108 -0
- data/spec/unit/knife/role_env_run_list_set_spec.rb +102 -0
- data/spec/unit/knife/role_from_file_spec.rb +10 -10
- data/spec/unit/knife/role_list_spec.rb +7 -7
- data/spec/unit/knife/role_run_list_add_spec.rb +179 -0
- data/spec/unit/knife/role_run_list_clear_spec.rb +90 -0
- data/spec/unit/knife/role_run_list_remove_spec.rb +98 -0
- data/spec/unit/knife/role_run_list_replace_spec.rb +101 -0
- data/spec/unit/knife/role_run_list_set_spec.rb +92 -0
- data/spec/unit/knife/ssh_spec.rb +66 -66
- data/spec/unit/knife/ssl_check_spec.rb +27 -27
- data/spec/unit/knife/ssl_fetch_spec.rb +45 -12
- data/spec/unit/knife/status_spec.rb +5 -5
- data/spec/unit/knife/tag_create_spec.rb +5 -5
- data/spec/unit/knife/tag_delete_spec.rb +6 -6
- data/spec/unit/knife/tag_list_spec.rb +4 -4
- data/spec/unit/knife/user_create_spec.rb +18 -18
- data/spec/unit/knife/user_delete_spec.rb +4 -4
- data/spec/unit/knife/user_edit_spec.rb +7 -7
- data/spec/unit/knife/user_list_spec.rb +2 -2
- data/spec/unit/knife/user_reregister_spec.rb +10 -10
- data/spec/unit/knife/user_show_spec.rb +5 -5
- data/spec/unit/knife_spec.rb +36 -36
- data/spec/unit/lwrp_spec.rb +63 -39
- data/spec/unit/mash_spec.rb +6 -6
- data/spec/unit/mixin/checksum_spec.rb +2 -2
- data/spec/unit/mixin/command_spec.rb +13 -13
- data/spec/unit/mixin/convert_to_class_name_spec.rb +6 -6
- data/spec/unit/mixin/deep_merge_spec.rb +49 -49
- data/spec/unit/mixin/deprecation_spec.rb +5 -5
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +14 -14
- data/spec/unit/mixin/homebrew_user_spec.rb +3 -3
- data/spec/unit/mixin/params_validate_spec.rb +71 -71
- data/spec/unit/mixin/path_sanity_spec.rb +14 -14
- data/spec/unit/mixin/securable_spec.rb +177 -177
- data/spec/unit/mixin/shell_out_spec.rb +56 -27
- data/spec/unit/mixin/template_spec.rb +31 -31
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +5 -5
- data/spec/unit/mixin/xml_escape_spec.rb +7 -7
- data/spec/unit/monkey_patches/uri_spec.rb +1 -1
- data/spec/unit/monologger_spec.rb +3 -3
- data/spec/unit/node/attribute_spec.rb +185 -136
- data/spec/unit/node/immutable_collections_spec.rb +22 -22
- data/spec/unit/node_spec.rb +210 -179
- data/spec/unit/org_spec.rb +196 -0
- data/spec/unit/platform/query_helpers_spec.rb +5 -5
- data/spec/unit/platform_spec.rb +46 -46
- data/spec/unit/policy_builder/expand_node_object_spec.rb +17 -18
- data/spec/unit/policy_builder/policyfile_spec.rb +159 -71
- data/spec/unit/provider/directory_spec.rb +5 -5
- data/spec/unit/provider/dsc_script_spec.rb +6 -6
- data/spec/unit/provider/env_spec.rb +27 -14
- data/spec/unit/provider/execute_spec.rb +139 -68
- data/spec/unit/provider/file/content_spec.rb +8 -8
- data/spec/unit/provider/git_spec.rb +10 -5
- data/spec/unit/provider/group/dscl_spec.rb +8 -11
- data/spec/unit/provider/group_spec.rb +13 -13
- data/spec/unit/provider/ifconfig/aix_spec.rb +3 -2
- data/spec/unit/provider/ifconfig/debian_spec.rb +19 -19
- data/spec/unit/provider/ifconfig_spec.rb +2 -2
- data/spec/unit/provider/mdadm_spec.rb +2 -2
- data/spec/unit/provider/mount/aix_spec.rb +5 -5
- data/spec/unit/provider/mount/mount_spec.rb +22 -22
- data/spec/unit/provider/mount/solaris_spec.rb +20 -20
- data/spec/unit/provider/package/aix_spec.rb +23 -22
- data/spec/unit/provider/package/apt_spec.rb +23 -4
- data/spec/unit/provider/package/dpkg_spec.rb +14 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
- data/spec/unit/provider/package/freebsd/port_spec.rb +1 -1
- data/spec/unit/provider/package/ips_spec.rb +1 -2
- data/spec/unit/provider/package/macports_spec.rb +14 -14
- data/spec/unit/provider/package/openbsd_spec.rb +66 -0
- data/spec/unit/provider/package/pacman_spec.rb +15 -14
- data/spec/unit/provider/package/portage_spec.rb +11 -11
- data/spec/unit/provider/package/rpm_spec.rb +132 -84
- data/spec/unit/provider/package/rubygems_spec.rb +54 -25
- data/spec/unit/provider/package/solaris_spec.rb +22 -25
- data/spec/unit/provider/package/yum_spec.rb +237 -36
- data/spec/unit/provider/package/zypper_spec.rb +9 -12
- data/spec/unit/provider/package_spec.rb +276 -2
- data/spec/unit/provider/package_spec.rbe +0 -0
- data/spec/unit/provider/remote_directory_spec.rb +25 -25
- data/spec/unit/provider/remote_file/ftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +3 -3
- data/spec/unit/provider/script_spec.rb +61 -43
- data/spec/unit/provider/service/aix_service_spec.rb +5 -5
- data/spec/unit/provider/service/arch_service_spec.rb +5 -5
- data/spec/unit/provider/service/debian_service_spec.rb +8 -8
- data/spec/unit/provider/service/freebsd_service_spec.rb +16 -2
- data/spec/unit/provider/service/gentoo_service_spec.rb +8 -8
- data/spec/unit/provider/service/init_service_spec.rb +5 -5
- data/spec/unit/provider/service/insserv_service_spec.rb +2 -2
- data/spec/unit/provider/service/invokercd_service_spec.rb +5 -5
- data/spec/unit/provider/service/macosx_spec.rb +7 -7
- data/spec/unit/provider/service/openbsd_service_spec.rb +543 -0
- data/spec/unit/provider/service/redhat_spec.rb +4 -4
- data/spec/unit/provider/service/simple_service_spec.rb +2 -2
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +14 -14
- data/spec/unit/provider/service/systemd_service_spec.rb +15 -7
- data/spec/unit/provider/service/upstart_service_spec.rb +4 -4
- data/spec/unit/provider/service/windows_spec.rb +119 -25
- data/spec/unit/provider/service_spec.rb +1 -1
- data/spec/unit/provider/user/dscl_spec.rb +38 -30
- data/spec/unit/provider/user_spec.rb +1 -1
- data/spec/unit/provider_resolver_spec.rb +7 -7
- data/spec/unit/provider_spec.rb +23 -23
- data/spec/unit/recipe_spec.rb +194 -83
- data/spec/unit/registry_helper_spec.rb +143 -143
- data/spec/unit/resource/chef_gem_spec.rb +117 -3
- data/spec/unit/resource/conditional_action_not_nothing_spec.rb +2 -2
- data/spec/unit/resource/conditional_spec.rb +56 -15
- data/spec/unit/resource/deploy_spec.rb +2 -2
- data/spec/unit/resource/dsc_script_spec.rb +32 -0
- data/spec/unit/resource/execute_spec.rb +4 -0
- data/spec/unit/resource/file/verification_spec.rb +111 -0
- data/spec/unit/resource/file_spec.rb +14 -0
- data/spec/unit/resource/openbsd_package_spec.rb +49 -0
- data/spec/unit/resource/remote_file_spec.rb +12 -12
- data/spec/unit/resource/resource_notification_spec.rb +18 -18
- data/spec/unit/resource/rpm_package_spec.rb +12 -0
- data/spec/unit/resource/scm_spec.rb +4 -4
- data/spec/unit/resource/script_spec.rb +3 -5
- data/spec/unit/resource/subversion_spec.rb +1 -1
- data/spec/unit/resource_builder_spec.rb +1 -0
- data/spec/unit/resource_collection/resource_list_spec.rb +2 -2
- data/spec/unit/resource_collection/resource_set_spec.rb +3 -3
- data/spec/unit/resource_collection/stepable_iterator_spec.rb +24 -24
- data/spec/unit/resource_collection_spec.rb +52 -52
- data/spec/unit/resource_definition_spec.rb +1 -1
- data/spec/unit/resource_reporter_spec.rb +118 -118
- data/spec/unit/resource_spec.rb +131 -125
- data/spec/unit/rest/auth_credentials_spec.rb +73 -73
- data/spec/unit/rest_spec.rb +12 -12
- data/spec/unit/role_spec.rb +85 -84
- data/spec/unit/run_context/cookbook_compiler_spec.rb +18 -18
- data/spec/unit/run_context_spec.rb +39 -68
- data/spec/unit/run_list/run_list_expansion_spec.rb +21 -21
- data/spec/unit/run_list/run_list_item_spec.rb +28 -28
- data/spec/unit/run_list/versioned_recipe_list_spec.rb +14 -14
- data/spec/unit/run_list_spec.rb +55 -55
- data/spec/unit/run_lock_spec.rb +14 -14
- data/spec/unit/run_status_spec.rb +24 -24
- data/spec/unit/scan_access_control_spec.rb +23 -23
- data/spec/unit/search/query_spec.rb +54 -66
- data/spec/unit/shell/model_wrapper_spec.rb +13 -13
- data/spec/unit/shell/shell_ext_spec.rb +32 -32
- data/spec/unit/shell/shell_session_spec.rb +24 -24
- data/spec/unit/shell_out_spec.rb +4 -4
- data/spec/unit/shell_spec.rb +27 -27
- data/spec/unit/user_spec.rb +50 -50
- data/spec/unit/util/backup_spec.rb +32 -32
- data/spec/unit/util/diff_spec.rb +31 -31
- data/spec/unit/util/dsc/configuration_generator_spec.rb +38 -16
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +21 -26
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +10 -10
- data/spec/unit/util/editor_spec.rb +10 -10
- data/spec/unit/util/file_edit_spec.rb +10 -10
- data/spec/unit/util/path_helper_spec.rb +38 -46
- data/spec/unit/util/powershell/cmdlet_spec.rb +9 -9
- data/spec/unit/util/selinux_spec.rb +30 -30
- data/spec/unit/util/threaded_job_queue_spec.rb +6 -6
- data/spec/unit/version/platform_spec.rb +5 -5
- data/spec/unit/version_class_spec.rb +15 -15
- data/spec/unit/version_constraint/platform_spec.rb +7 -7
- data/spec/unit/version_constraint_spec.rb +43 -43
- data/spec/unit/windows_service_spec.rb +15 -15
- data/spec/unit/workstation_config_loader_spec.rb +2 -2
- data/tasks/rspec.rb +16 -18
- metadata +126 -49
- data/bin/shef +0 -35
- data/lib/chef/application/agent.rb +0 -18
- data/lib/chef/monkey_patches/fileutils.rb +0 -65
- data/lib/chef/monkey_patches/numeric.rb +0 -15
- data/lib/chef/monkey_patches/object.rb +0 -9
- data/lib/chef/monkey_patches/pathname.rb +0 -32
- data/lib/chef/monkey_patches/regexp.rb +0 -34
- data/lib/chef/monkey_patches/securerandom.rb +0 -44
- data/lib/chef/monkey_patches/string.rb +0 -49
- data/lib/chef/monkey_patches/tempfile.rb +0 -64
- data/lib/chef/monkey_patches/uri.rb +0 -70
@@ -30,28 +30,28 @@ describe Chef::Node::ImmutableMash do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "element references like regular hash" do
|
33
|
-
@immutable_mash[:top][:second_level].
|
33
|
+
expect(@immutable_mash[:top][:second_level]).to eq("some value")
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
37
|
-
@immutable_mash[:top_level_2].
|
36
|
+
it "element references like a regular Mash" do
|
37
|
+
expect(@immutable_mash[:top_level_2]).to eq(%w[array of values])
|
38
38
|
end
|
39
39
|
|
40
40
|
it "converts Hash-like inputs into ImmutableMash's" do
|
41
|
-
@immutable_mash[:top].
|
41
|
+
expect(@immutable_mash[:top]).to be_a(Chef::Node::ImmutableMash)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "converts array inputs into ImmutableArray's" do
|
45
|
-
@immutable_mash[:top_level_2].
|
45
|
+
expect(@immutable_mash[:top_level_2]).to be_a(Chef::Node::ImmutableArray)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "converts arrays of hashes to ImmutableArray's of ImmutableMashes" do
|
49
|
-
@immutable_mash[:top_level_3].first.
|
49
|
+
expect(@immutable_mash[:top_level_3].first).to be_a(Chef::Node::ImmutableMash)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "converts nested hashes to ImmutableMashes" do
|
53
|
-
@immutable_mash[:top_level_4].
|
54
|
-
@immutable_mash[:top_level_4][:level2].
|
53
|
+
expect(@immutable_mash[:top_level_4]).to be_a(Chef::Node::ImmutableMash)
|
54
|
+
expect(@immutable_mash[:top_level_4][:level2]).to be_a(Chef::Node::ImmutableMash)
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "to_hash" do
|
@@ -60,23 +60,23 @@ describe Chef::Node::ImmutableMash do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "converts an immutable mash to a new mutable hash" do
|
63
|
-
@copy.
|
63
|
+
expect(@copy).to be_instance_of(Hash)
|
64
64
|
end
|
65
65
|
|
66
66
|
it "converts an immutable nested mash to a new mutable hash" do
|
67
|
-
@copy['top_level_4']['level2'].
|
67
|
+
expect(@copy['top_level_4']['level2']).to be_instance_of(Hash)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "converts an immutable nested array to a new mutable array" do
|
71
|
-
@copy['top_level_2'].
|
71
|
+
expect(@copy['top_level_2']).to be_instance_of(Array)
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should create a mash with the same content" do
|
75
|
-
@copy.
|
75
|
+
expect(@copy).to eq(@immutable_mash)
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'should allow mutation' do
|
79
|
-
|
79
|
+
expect { @copy['m'] = 'm' }.not_to raise_error
|
80
80
|
end
|
81
81
|
|
82
82
|
end
|
@@ -97,14 +97,14 @@ describe Chef::Node::ImmutableMash do
|
|
97
97
|
:shift
|
98
98
|
].each do |mutator|
|
99
99
|
it "doesn't allow mutation via `#{mutator}'" do
|
100
|
-
|
100
|
+
expect { @immutable_mash.send(mutator) }.to raise_error
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
104
|
it "returns a mutable version of itself when duped" do
|
105
105
|
mutable = @immutable_mash.dup
|
106
106
|
mutable[:new_key] = :value
|
107
|
-
mutable[:new_key].
|
107
|
+
expect(mutable[:new_key]).to eq(:value)
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
@@ -154,7 +154,7 @@ describe Chef::Node::ImmutableArray do
|
|
154
154
|
:unshift
|
155
155
|
].each do |mutator|
|
156
156
|
it "does not allow mutation via `#{mutator}" do
|
157
|
-
|
157
|
+
expect { @immutable_array.send(mutator)}.to raise_error
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -165,7 +165,7 @@ describe Chef::Node::ImmutableArray do
|
|
165
165
|
it "returns a mutable version of itself when duped" do
|
166
166
|
mutable = @immutable_array.dup
|
167
167
|
mutable[0] = :value
|
168
|
-
mutable[0].
|
168
|
+
expect(mutable[0]).to eq(:value)
|
169
169
|
end
|
170
170
|
|
171
171
|
describe "to_a" do
|
@@ -174,23 +174,23 @@ describe Chef::Node::ImmutableArray do
|
|
174
174
|
end
|
175
175
|
|
176
176
|
it "converts an immutable array to a new mutable array" do
|
177
|
-
@copy.
|
177
|
+
expect(@copy).to be_instance_of(Array)
|
178
178
|
end
|
179
179
|
|
180
180
|
it "converts an immutable nested array to a new mutable array" do
|
181
|
-
@copy[1].
|
181
|
+
expect(@copy[1]).to be_instance_of(Array)
|
182
182
|
end
|
183
183
|
|
184
184
|
it "converts an immutable nested mash to a new mutable hash" do
|
185
|
-
@copy[2].
|
185
|
+
expect(@copy[2]).to be_instance_of(Hash)
|
186
186
|
end
|
187
187
|
|
188
188
|
it "should create an array with the same content" do
|
189
|
-
@copy.
|
189
|
+
expect(@copy).to eq(@immutable_nested_array)
|
190
190
|
end
|
191
191
|
|
192
192
|
it 'should allow mutation' do
|
193
|
-
|
193
|
+
expect { @copy << 'm' }.not_to raise_error
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
data/spec/unit/node_spec.rb
CHANGED
@@ -28,167 +28,167 @@ describe Chef::Node do
|
|
28
28
|
|
29
29
|
it "creates a node and assigns it a name" do
|
30
30
|
node = Chef::Node.build('solo-node')
|
31
|
-
node.name.
|
31
|
+
expect(node.name).to eq('solo-node')
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should validate the name of the node" do
|
35
|
-
|
35
|
+
expect{Chef::Node.build('solo node')}.to raise_error(Chef::Exceptions::ValidationFailed)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should be sortable" do
|
39
39
|
n1 = Chef::Node.build('alpha')
|
40
40
|
n2 = Chef::Node.build('beta')
|
41
41
|
n3 = Chef::Node.build('omega')
|
42
|
-
[n3, n1, n2].sort.
|
42
|
+
expect([n3, n1, n2].sort).to eq([n1, n2, n3])
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "when the node does not exist on the server" do
|
46
46
|
before do
|
47
47
|
response = OpenStruct.new(:code => '404')
|
48
48
|
exception = Net::HTTPServerException.new("404 not found", response)
|
49
|
-
Chef::Node.
|
49
|
+
allow(Chef::Node).to receive(:load).and_raise(exception)
|
50
50
|
node.name("created-node")
|
51
51
|
end
|
52
52
|
|
53
53
|
it "creates a new node for find_or_create" do
|
54
|
-
Chef::Node.
|
55
|
-
node.
|
54
|
+
allow(Chef::Node).to receive(:new).and_return(node)
|
55
|
+
expect(node).to receive(:create).and_return(node)
|
56
56
|
node = Chef::Node.find_or_create("created-node")
|
57
|
-
node.name.
|
58
|
-
node.
|
57
|
+
expect(node.name).to eq('created-node')
|
58
|
+
expect(node).to equal(node)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe "when the node exists on the server" do
|
63
63
|
before do
|
64
64
|
node.name('existing-node')
|
65
|
-
Chef::Node.
|
65
|
+
allow(Chef::Node).to receive(:load).and_return(node)
|
66
66
|
end
|
67
67
|
|
68
68
|
it "loads the node via the REST API for find_or_create" do
|
69
|
-
Chef::Node.find_or_create('existing-node').
|
69
|
+
expect(Chef::Node.find_or_create('existing-node')).to equal(node)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
describe "run_state" do
|
74
74
|
it "is an empty hash" do
|
75
|
-
node.run_state.
|
76
|
-
node.run_state.
|
75
|
+
expect(node.run_state).to respond_to(:keys)
|
76
|
+
expect(node.run_state).to be_empty
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "initialize" do
|
81
81
|
it "should default to the '_default' chef_environment" do
|
82
82
|
n = Chef::Node.new
|
83
|
-
n.chef_environment.
|
83
|
+
expect(n.chef_environment).to eq('_default')
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
describe "name" do
|
88
88
|
it "should allow you to set a name with name(something)" do
|
89
|
-
|
89
|
+
expect { node.name("latte") }.not_to raise_error
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should return the name with name()" do
|
93
93
|
node.name("latte")
|
94
|
-
node.name.
|
94
|
+
expect(node.name).to eql("latte")
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should always have a string for name" do
|
98
|
-
|
98
|
+
expect { node.name(Hash.new) }.to raise_error(ArgumentError)
|
99
99
|
end
|
100
100
|
|
101
101
|
it "cannot be blank" do
|
102
|
-
|
102
|
+
expect { node.name("")}.to raise_error(Chef::Exceptions::ValidationFailed)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should not accept name doesn't match /^[\-[:alnum:]_:.]+$/" do
|
106
|
-
|
106
|
+
expect { node.name("space in it")}.to raise_error(Chef::Exceptions::ValidationFailed)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
110
|
describe "chef_environment" do
|
111
111
|
it "should set an environment with chef_environment(something)" do
|
112
|
-
|
112
|
+
expect { node.chef_environment("latte") }.not_to raise_error
|
113
113
|
end
|
114
114
|
|
115
115
|
it "should return the chef_environment with chef_environment()" do
|
116
116
|
node.chef_environment("latte")
|
117
|
-
node.chef_environment.
|
117
|
+
expect(node.chef_environment).to eq("latte")
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should disallow non-strings" do
|
121
|
-
|
122
|
-
|
121
|
+
expect { node.chef_environment(Hash.new) }.to raise_error(ArgumentError)
|
122
|
+
expect { node.chef_environment(42) }.to raise_error(ArgumentError)
|
123
123
|
end
|
124
124
|
|
125
125
|
it "cannot be blank" do
|
126
|
-
|
126
|
+
expect { node.chef_environment("")}.to raise_error(Chef::Exceptions::ValidationFailed)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
describe "attributes" do
|
131
131
|
it "should have attributes" do
|
132
|
-
node.attribute.
|
132
|
+
expect(node.attribute).to be_a_kind_of(Hash)
|
133
133
|
end
|
134
134
|
|
135
135
|
it "should allow attributes to be accessed by name or symbol directly on node[]" do
|
136
136
|
node.default["locust"] = "something"
|
137
|
-
node[:locust].
|
138
|
-
node["locust"].
|
137
|
+
expect(node[:locust]).to eql("something")
|
138
|
+
expect(node["locust"]).to eql("something")
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should return nil if it cannot find an attribute with node[]" do
|
142
|
-
node["secret"].
|
142
|
+
expect(node["secret"]).to eql(nil)
|
143
143
|
end
|
144
144
|
|
145
145
|
it "does not allow you to set an attribute via node[]=" do
|
146
|
-
|
146
|
+
expect { node["secret"] = "shush" }.to raise_error(Chef::Exceptions::ImmutableAttributeModification)
|
147
147
|
end
|
148
148
|
|
149
149
|
it "should allow you to query whether an attribute exists with attribute?" do
|
150
150
|
node.default["locust"] = "something"
|
151
|
-
node.attribute?("locust").
|
152
|
-
node.attribute?("no dice").
|
151
|
+
expect(node.attribute?("locust")).to eql(true)
|
152
|
+
expect(node.attribute?("no dice")).to eql(false)
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should let you go deep with attribute?" do
|
156
156
|
node.set["battles"]["people"]["wonkey"] = true
|
157
|
-
node["battles"]["people"].attribute?("wonkey").
|
158
|
-
node["battles"]["people"].attribute?("snozzberry").
|
157
|
+
expect(node["battles"]["people"].attribute?("wonkey")).to eq(true)
|
158
|
+
expect(node["battles"]["people"].attribute?("snozzberry")).to eq(false)
|
159
159
|
end
|
160
160
|
|
161
161
|
it "does not allow you to set an attribute via method_missing" do
|
162
|
-
|
162
|
+
expect { node.sunshine = "is bright"}.to raise_error(Chef::Exceptions::ImmutableAttributeModification)
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should allow you get get an attribute via method_missing" do
|
166
166
|
node.default.sunshine = "is bright"
|
167
|
-
node.sunshine.
|
167
|
+
expect(node.sunshine).to eql("is bright")
|
168
168
|
end
|
169
169
|
|
170
170
|
describe "normal attributes" do
|
171
171
|
it "should allow you to set an attribute with set, without pre-declaring a hash" do
|
172
172
|
node.set[:snoopy][:is_a_puppy] = true
|
173
|
-
node[:snoopy][:is_a_puppy].
|
173
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
174
174
|
end
|
175
175
|
|
176
176
|
it "should allow you to set an attribute with set_unless" do
|
177
177
|
node.set_unless[:snoopy][:is_a_puppy] = false
|
178
|
-
node[:snoopy][:is_a_puppy].
|
178
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(false)
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should not allow you to set an attribute with set_unless if it already exists" do
|
182
182
|
node.set[:snoopy][:is_a_puppy] = true
|
183
183
|
node.set_unless[:snoopy][:is_a_puppy] = false
|
184
|
-
node[:snoopy][:is_a_puppy].
|
184
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
185
185
|
end
|
186
186
|
|
187
187
|
it "should allow you to set a value after a set_unless" do
|
188
188
|
# this tests for set_unless_present state bleeding between statements CHEF-3806
|
189
189
|
node.set_unless[:snoopy][:is_a_puppy] = false
|
190
190
|
node.set[:snoopy][:is_a_puppy] = true
|
191
|
-
node[:snoopy][:is_a_puppy].
|
191
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should let you set a value after a 'dangling' set_unless" do
|
@@ -196,43 +196,43 @@ describe Chef::Node do
|
|
196
196
|
node.set[:snoopy][:is_a_puppy] = "what"
|
197
197
|
node.set_unless[:snoopy][:is_a_puppy]
|
198
198
|
node.set[:snoopy][:is_a_puppy] = true
|
199
|
-
node[:snoopy][:is_a_puppy].
|
199
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
200
200
|
end
|
201
201
|
|
202
202
|
it "auto-vivifies attributes created via method syntax" do
|
203
203
|
node.set.fuu.bahrr.baz = "qux"
|
204
|
-
node.fuu.bahrr.baz.
|
204
|
+
expect(node.fuu.bahrr.baz).to eq("qux")
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should let you use tag as a convience method for the tags attribute" do
|
208
208
|
node.normal['tags'] = ['one', 'two']
|
209
209
|
node.tag('three', 'four')
|
210
|
-
node['tags'].
|
210
|
+
expect(node['tags']).to eq(['one', 'two', 'three', 'four'])
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
214
|
describe "default attributes" do
|
215
215
|
it "should be set with default, without pre-declaring a hash" do
|
216
216
|
node.default[:snoopy][:is_a_puppy] = true
|
217
|
-
node[:snoopy][:is_a_puppy].
|
217
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
218
218
|
end
|
219
219
|
|
220
220
|
it "should allow you to set with default_unless without pre-declaring a hash" do
|
221
221
|
node.default_unless[:snoopy][:is_a_puppy] = false
|
222
|
-
node[:snoopy][:is_a_puppy].
|
222
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(false)
|
223
223
|
end
|
224
224
|
|
225
225
|
it "should not allow you to set an attribute with default_unless if it already exists" do
|
226
226
|
node.default[:snoopy][:is_a_puppy] = true
|
227
227
|
node.default_unless[:snoopy][:is_a_puppy] = false
|
228
|
-
node[:snoopy][:is_a_puppy].
|
228
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should allow you to set a value after a default_unless" do
|
232
232
|
# this tests for set_unless_present state bleeding between statements CHEF-3806
|
233
233
|
node.default_unless[:snoopy][:is_a_puppy] = false
|
234
234
|
node.default[:snoopy][:is_a_puppy] = true
|
235
|
-
node[:snoopy][:is_a_puppy].
|
235
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
236
236
|
end
|
237
237
|
|
238
238
|
it "should allow you to set a value after a 'dangling' default_unless" do
|
@@ -240,37 +240,37 @@ describe Chef::Node do
|
|
240
240
|
node.default[:snoopy][:is_a_puppy] = "what"
|
241
241
|
node.default_unless[:snoopy][:is_a_puppy]
|
242
242
|
node.default[:snoopy][:is_a_puppy] = true
|
243
|
-
node[:snoopy][:is_a_puppy].
|
243
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
244
244
|
end
|
245
245
|
|
246
246
|
it "auto-vivifies attributes created via method syntax" do
|
247
247
|
node.default.fuu.bahrr.baz = "qux"
|
248
|
-
node.fuu.bahrr.baz.
|
248
|
+
expect(node.fuu.bahrr.baz).to eq("qux")
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
252
|
describe "override attributes" do
|
253
253
|
it "should be set with override, without pre-declaring a hash" do
|
254
254
|
node.override[:snoopy][:is_a_puppy] = true
|
255
|
-
node[:snoopy][:is_a_puppy].
|
255
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
256
256
|
end
|
257
257
|
|
258
258
|
it "should allow you to set with override_unless without pre-declaring a hash" do
|
259
259
|
node.override_unless[:snoopy][:is_a_puppy] = false
|
260
|
-
node[:snoopy][:is_a_puppy].
|
260
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(false)
|
261
261
|
end
|
262
262
|
|
263
263
|
it "should not allow you to set an attribute with override_unless if it already exists" do
|
264
264
|
node.override[:snoopy][:is_a_puppy] = true
|
265
265
|
node.override_unless[:snoopy][:is_a_puppy] = false
|
266
|
-
node[:snoopy][:is_a_puppy].
|
266
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
267
267
|
end
|
268
268
|
|
269
269
|
it "should allow you to set a value after an override_unless" do
|
270
270
|
# this tests for set_unless_present state bleeding between statements CHEF-3806
|
271
271
|
node.override_unless[:snoopy][:is_a_puppy] = false
|
272
272
|
node.override[:snoopy][:is_a_puppy] = true
|
273
|
-
node[:snoopy][:is_a_puppy].
|
273
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
274
274
|
end
|
275
275
|
|
276
276
|
it "should allow you to set a value after a 'dangling' override_unless" do
|
@@ -278,12 +278,12 @@ describe Chef::Node do
|
|
278
278
|
node.override_unless[:snoopy][:is_a_puppy] = "what"
|
279
279
|
node.override_unless[:snoopy][:is_a_puppy]
|
280
280
|
node.override[:snoopy][:is_a_puppy] = true
|
281
|
-
node[:snoopy][:is_a_puppy].
|
281
|
+
expect(node[:snoopy][:is_a_puppy]).to eq(true)
|
282
282
|
end
|
283
283
|
|
284
284
|
it "auto-vivifies attributes created via method syntax" do
|
285
285
|
node.override.fuu.bahrr.baz = "qux"
|
286
|
-
node.fuu.bahrr.baz.
|
286
|
+
expect(node.fuu.bahrr.baz).to eq("qux")
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
@@ -611,8 +611,39 @@ describe Chef::Node do
|
|
611
611
|
end
|
612
612
|
end
|
613
613
|
|
614
|
+
# In Chef-12.0 there is a deep_merge cache on the top level attribute which had a bug
|
615
|
+
# where it cached node[:foo] separate from node['foo']. These tests exercise those edge conditions.
|
616
|
+
#
|
617
|
+
# https://github.com/opscode/chef/issues/2700
|
618
|
+
# https://github.com/opscode/chef/issues/2712
|
619
|
+
# https://github.com/opscode/chef/issues/2745
|
620
|
+
#
|
621
|
+
describe "deep merge attribute cache edge conditions" do
|
622
|
+
it "does not error with complicated attribute substitution" do
|
623
|
+
node.default['chef_attribute_hell']['attr1'] = "attribute1"
|
624
|
+
node.default['chef_attribute_hell']['attr2'] = "#{node.chef_attribute_hell.attr1}/attr2"
|
625
|
+
expect { node.default['chef_attribute_hell']['attr3'] = "#{node.chef_attribute_hell.attr2}/attr3" }.not_to raise_error
|
626
|
+
end
|
627
|
+
|
628
|
+
it "caches both strings and symbols correctly" do
|
629
|
+
node.force_default[:solr][:version] = '4.10.2'
|
630
|
+
node.force_default[:solr][:data_dir] = "/opt/solr-#{node['solr'][:version]}/example/solr"
|
631
|
+
node.force_default[:solr][:xms] = "512M"
|
632
|
+
expect(node[:solr][:xms]).to eql("512M")
|
633
|
+
expect(node['solr'][:xms]).to eql("512M")
|
634
|
+
end
|
635
|
+
|
636
|
+
it "method interpolation syntax also works" do
|
637
|
+
node.default['passenger']['version'] = '4.0.57'
|
638
|
+
node.default['passenger']['root_path'] = "passenger-#{node['passenger']['version']}"
|
639
|
+
node.default['passenger']['root_path_2'] = "passenger-#{node.passenger['version']}"
|
640
|
+
expect(node['passenger']['root_path_2']).to eql("passenger-4.0.57")
|
641
|
+
expect(node[:passenger]['root_path_2']).to eql("passenger-4.0.57")
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
614
645
|
it "should raise an ArgumentError if you ask for an attribute that doesn't exist via method_missing" do
|
615
|
-
|
646
|
+
expect { node.sunshine }.to raise_error(NoMethodError)
|
616
647
|
end
|
617
648
|
|
618
649
|
it "should allow you to iterate over attributes with each_attribute" do
|
@@ -622,10 +653,10 @@ describe Chef::Node do
|
|
622
653
|
node.each_attribute do |a,v|
|
623
654
|
seen_attributes[a] = v
|
624
655
|
end
|
625
|
-
seen_attributes.
|
626
|
-
seen_attributes.
|
627
|
-
seen_attributes["sunshine"].
|
628
|
-
seen_attributes["canada"].
|
656
|
+
expect(seen_attributes).to have_key("sunshine")
|
657
|
+
expect(seen_attributes).to have_key("canada")
|
658
|
+
expect(seen_attributes["sunshine"]).to eq("is bright")
|
659
|
+
expect(seen_attributes["canada"]).to eq("is a nice place")
|
629
660
|
end
|
630
661
|
end
|
631
662
|
|
@@ -637,62 +668,62 @@ describe Chef::Node do
|
|
637
668
|
|
638
669
|
it "consumes the run list portion of a collection of attributes and returns the remainder" do
|
639
670
|
attrs = {"run_list" => [ "role[base]", "recipe[chef::server]" ], "foo" => "bar"}
|
640
|
-
node.consume_run_list(attrs).
|
641
|
-
node.run_list.
|
671
|
+
expect(node.consume_run_list(attrs)).to eq({"foo" => "bar"})
|
672
|
+
expect(node.run_list).to eq([ "role[base]", "recipe[chef::server]" ])
|
642
673
|
end
|
643
674
|
|
644
675
|
it "should overwrites the run list with the run list it consumes" do
|
645
676
|
node.consume_run_list "recipes" => [ "one", "two" ]
|
646
677
|
node.consume_run_list "recipes" => [ "three" ]
|
647
|
-
node.run_list.
|
678
|
+
expect(node.run_list).to eq([ "three" ])
|
648
679
|
end
|
649
680
|
|
650
681
|
it "should not add duplicate recipes from the json attributes" do
|
651
682
|
node.run_list << "one"
|
652
683
|
node.consume_run_list "recipes" => [ "one", "two", "three" ]
|
653
|
-
node.run_list.
|
684
|
+
expect(node.run_list).to eq([ "one", "two", "three" ])
|
654
685
|
end
|
655
686
|
|
656
687
|
it "doesn't change the run list if no run_list is specified in the json" do
|
657
688
|
node.run_list << "role[database]"
|
658
689
|
node.consume_run_list "foo" => "bar"
|
659
|
-
node.run_list.
|
690
|
+
expect(node.run_list).to eq(["role[database]"])
|
660
691
|
end
|
661
692
|
|
662
693
|
it "raises an exception if you provide both recipe and run_list attributes, since this is ambiguous" do
|
663
|
-
|
694
|
+
expect { node.consume_run_list "recipes" => "stuff", "run_list" => "other_stuff" }.to raise_error(Chef::Exceptions::AmbiguousRunlistSpecification)
|
664
695
|
end
|
665
696
|
|
666
697
|
it "should add json attributes to the node" do
|
667
698
|
node.consume_external_attrs(@ohai_data, {"one" => "two", "three" => "four"})
|
668
|
-
node.one.
|
669
|
-
node.three.
|
699
|
+
expect(node.one).to eql("two")
|
700
|
+
expect(node.three).to eql("four")
|
670
701
|
end
|
671
702
|
|
672
703
|
it "should set the tags attribute to an empty array if it is not already defined" do
|
673
704
|
node.consume_external_attrs(@ohai_data, {})
|
674
|
-
node.tags.
|
705
|
+
expect(node.tags).to eql([])
|
675
706
|
end
|
676
707
|
|
677
708
|
it "should not set the tags attribute to an empty array if it is already defined" do
|
678
709
|
node.normal[:tags] = [ "radiohead" ]
|
679
710
|
node.consume_external_attrs(@ohai_data, {})
|
680
|
-
node.tags.
|
711
|
+
expect(node.tags).to eql([ "radiohead" ])
|
681
712
|
end
|
682
713
|
|
683
714
|
it "deep merges attributes instead of overwriting them" do
|
684
715
|
node.consume_external_attrs(@ohai_data, "one" => {"two" => {"three" => "four"}})
|
685
|
-
node.one.to_hash.
|
716
|
+
expect(node.one.to_hash).to eq({"two" => {"three" => "four"}})
|
686
717
|
node.consume_external_attrs(@ohai_data, "one" => {"abc" => "123"})
|
687
718
|
node.consume_external_attrs(@ohai_data, "one" => {"two" => {"foo" => "bar"}})
|
688
|
-
node.one.to_hash.
|
719
|
+
expect(node.one.to_hash).to eq({"two" => {"three" => "four", "foo" => "bar"}, "abc" => "123"})
|
689
720
|
end
|
690
721
|
|
691
722
|
it "gives attributes from JSON priority when deep merging" do
|
692
723
|
node.consume_external_attrs(@ohai_data, "one" => {"two" => {"three" => "four"}})
|
693
|
-
node.one.to_hash.
|
724
|
+
expect(node.one.to_hash).to eq({"two" => {"three" => "four"}})
|
694
725
|
node.consume_external_attrs(@ohai_data, "one" => {"two" => {"three" => "forty-two"}})
|
695
|
-
node.one.to_hash.
|
726
|
+
expect(node.one.to_hash).to eq({"two" => {"three" => "forty-two"}})
|
696
727
|
end
|
697
728
|
|
698
729
|
end
|
@@ -704,21 +735,21 @@ describe Chef::Node do
|
|
704
735
|
|
705
736
|
it "sets its platform according to platform detection" do
|
706
737
|
node.consume_external_attrs(@ohai_data, {})
|
707
|
-
node.automatic_attrs[:platform].
|
708
|
-
node.automatic_attrs[:platform_version].
|
738
|
+
expect(node.automatic_attrs[:platform]).to eq('foobuntu')
|
739
|
+
expect(node.automatic_attrs[:platform_version]).to eq('23.42')
|
709
740
|
end
|
710
741
|
|
711
742
|
it "consumes the run list from provided json attributes" do
|
712
743
|
node.consume_external_attrs(@ohai_data, {"run_list" => ['recipe[unicorn]']})
|
713
|
-
node.run_list.
|
744
|
+
expect(node.run_list).to eq(['recipe[unicorn]'])
|
714
745
|
end
|
715
746
|
|
716
747
|
it "saves non-runlist json attrs for later" do
|
717
748
|
expansion = Chef::RunList::RunListExpansion.new('_default', [])
|
718
|
-
node.run_list.
|
749
|
+
allow(node.run_list).to receive(:expand).and_return(expansion)
|
719
750
|
node.consume_external_attrs(@ohai_data, {"foo" => "bar"})
|
720
751
|
node.expand!
|
721
|
-
node.normal_attrs.
|
752
|
+
expect(node.normal_attrs).to eq({"foo" => "bar", "tags" => []})
|
722
753
|
end
|
723
754
|
|
724
755
|
end
|
@@ -730,44 +761,44 @@ describe Chef::Node do
|
|
730
761
|
e.default_attributes("env default key" => "env default value")
|
731
762
|
e.override_attributes("env override key" => "env override value")
|
732
763
|
end
|
733
|
-
Chef::Environment.
|
764
|
+
expect(Chef::Environment).to receive(:load).with("rspec_env").and_return(@environment)
|
734
765
|
@expansion = Chef::RunList::RunListExpansion.new("rspec_env", [])
|
735
766
|
node.chef_environment("rspec_env")
|
736
|
-
node.run_list.
|
767
|
+
allow(node.run_list).to receive(:expand).and_return(@expansion)
|
737
768
|
end
|
738
769
|
|
739
770
|
it "sets the 'recipes' automatic attribute to the recipes in the expanded run_list" do
|
740
771
|
@expansion.recipes << 'recipe[chef::client]' << 'recipe[nginx::default]'
|
741
772
|
node.expand!
|
742
|
-
node.automatic_attrs[:recipes].
|
773
|
+
expect(node.automatic_attrs[:recipes]).to eq(['recipe[chef::client]', 'recipe[nginx::default]'])
|
743
774
|
end
|
744
775
|
|
745
776
|
it "sets the 'roles' automatic attribute to the expanded role list" do
|
746
777
|
@expansion.instance_variable_set(:@applied_roles, {'arf' => nil, 'countersnark' => nil})
|
747
778
|
node.expand!
|
748
|
-
node.automatic_attrs[:roles].sort.
|
779
|
+
expect(node.automatic_attrs[:roles].sort).to eq(['arf', 'countersnark'])
|
749
780
|
end
|
750
781
|
|
751
782
|
it "applies default attributes from the environment as environment defaults" do
|
752
783
|
node.expand!
|
753
|
-
node.attributes.env_default["env default key"].
|
784
|
+
expect(node.attributes.env_default["env default key"]).to eq("env default value")
|
754
785
|
end
|
755
786
|
|
756
787
|
it "applies override attributes from the environment as env overrides" do
|
757
788
|
node.expand!
|
758
|
-
node.attributes.env_override["env override key"].
|
789
|
+
expect(node.attributes.env_override["env override key"]).to eq("env override value")
|
759
790
|
end
|
760
791
|
|
761
792
|
it "applies default attributes from roles as role defaults" do
|
762
793
|
@expansion.default_attrs["role default key"] = "role default value"
|
763
794
|
node.expand!
|
764
|
-
node.attributes.role_default["role default key"].
|
795
|
+
expect(node.attributes.role_default["role default key"]).to eq("role default value")
|
765
796
|
end
|
766
797
|
|
767
798
|
it "applies override attributes from roles as role overrides" do
|
768
799
|
@expansion.override_attrs["role override key"] = "role override value"
|
769
800
|
node.expand!
|
770
|
-
node.attributes.role_override["role override key"].
|
801
|
+
expect(node.attributes.role_override["role override key"]).to eq("role override value")
|
771
802
|
end
|
772
803
|
end
|
773
804
|
|
@@ -782,8 +813,8 @@ describe Chef::Node do
|
|
782
813
|
node.automatic_attrs[:recipes] = [ "nginx::other_module" ]
|
783
814
|
node.loaded_recipe(:nginx, "module")
|
784
815
|
expect(node.automatic_attrs[:recipes].length).to eq(2)
|
785
|
-
expect(node.recipe?("nginx::module")).to
|
786
|
-
expect(node.recipe?("nginx::other_module")).to
|
816
|
+
expect(node.recipe?("nginx::module")).to be true
|
817
|
+
expect(node.recipe?("nginx::other_module")).to be true
|
787
818
|
end
|
788
819
|
end
|
789
820
|
|
@@ -794,11 +825,11 @@ describe Chef::Node do
|
|
794
825
|
end
|
795
826
|
|
796
827
|
it "finds the recipe" do
|
797
|
-
node.recipe?("nginx::module").
|
828
|
+
expect(node.recipe?("nginx::module")).to be true
|
798
829
|
end
|
799
830
|
|
800
831
|
it "does not find a recipe not in the run list" do
|
801
|
-
node.recipe?("nginx::other_module").
|
832
|
+
expect(node.recipe?("nginx::other_module")).to be false
|
802
833
|
end
|
803
834
|
end
|
804
835
|
context "when a recipe is in the expanded run list only" do
|
@@ -808,11 +839,11 @@ describe Chef::Node do
|
|
808
839
|
end
|
809
840
|
|
810
841
|
it "finds a recipe in the expanded run list" do
|
811
|
-
node.recipe?("nginx::module").
|
842
|
+
expect(node.recipe?("nginx::module")).to be true
|
812
843
|
end
|
813
844
|
|
814
845
|
it "does not find a recipe that's not in the run list" do
|
815
|
-
node.recipe?("nginx::other_module").
|
846
|
+
expect(node.recipe?("nginx::other_module")).to be false
|
816
847
|
end
|
817
848
|
end
|
818
849
|
end
|
@@ -826,15 +857,15 @@ describe Chef::Node do
|
|
826
857
|
end
|
827
858
|
|
828
859
|
it "removes default attributes" do
|
829
|
-
node.default.
|
860
|
+
expect(node.default).to be_empty
|
830
861
|
end
|
831
862
|
|
832
863
|
it "removes override attributes" do
|
833
|
-
node.override.
|
864
|
+
expect(node.override).to be_empty
|
834
865
|
end
|
835
866
|
|
836
867
|
it "leaves normal level attributes untouched" do
|
837
|
-
node[:foo].
|
868
|
+
expect(node[:foo]).to eq("normal")
|
838
869
|
end
|
839
870
|
|
840
871
|
end
|
@@ -849,32 +880,32 @@ describe Chef::Node do
|
|
849
880
|
@environment = Chef::Environment.new
|
850
881
|
@environment.default_attributes = {:default => "from env", :d_env => "env only" }
|
851
882
|
@environment.override_attributes = {:override => "from env", :o_env => "env only"}
|
852
|
-
Chef::Environment.
|
883
|
+
allow(Chef::Environment).to receive(:load).and_return(@environment)
|
853
884
|
node.apply_expansion_attributes(@expansion)
|
854
885
|
end
|
855
886
|
|
856
887
|
it "does not nuke role-only default attrs" do
|
857
|
-
node[:d_role].
|
888
|
+
expect(node[:d_role]).to eq("role only")
|
858
889
|
end
|
859
890
|
|
860
891
|
it "does not nuke role-only override attrs" do
|
861
|
-
node[:o_role].
|
892
|
+
expect(node[:o_role]).to eq("role only")
|
862
893
|
end
|
863
894
|
|
864
895
|
it "does not nuke env-only default attrs" do
|
865
|
-
node[:o_env].
|
896
|
+
expect(node[:o_env]).to eq("env only")
|
866
897
|
end
|
867
898
|
|
868
899
|
it "does not nuke role-only override attrs" do
|
869
|
-
node[:o_env].
|
900
|
+
expect(node[:o_env]).to eq("env only")
|
870
901
|
end
|
871
902
|
|
872
903
|
it "gives role defaults precedence over env defaults" do
|
873
|
-
node[:default].
|
904
|
+
expect(node[:default]).to eq("from role")
|
874
905
|
end
|
875
906
|
|
876
907
|
it "gives env overrides precedence over role overrides" do
|
877
|
-
node[:override].
|
908
|
+
expect(node[:override]).to eq("from env")
|
878
909
|
end
|
879
910
|
end
|
880
911
|
|
@@ -894,60 +925,60 @@ describe Chef::Node do
|
|
894
925
|
end
|
895
926
|
|
896
927
|
it "sets attributes from the files" do
|
897
|
-
node.ldap_server.
|
898
|
-
node.ldap_basedn.
|
899
|
-
node.ldap_replication_password.
|
900
|
-
node.smokey.
|
928
|
+
expect(node.ldap_server).to eql("ops1prod")
|
929
|
+
expect(node.ldap_basedn).to eql("dc=hjksolutions,dc=com")
|
930
|
+
expect(node.ldap_replication_password).to eql("forsure")
|
931
|
+
expect(node.smokey).to eql("robinson")
|
901
932
|
end
|
902
933
|
|
903
934
|
it "gives a sensible error when attempting to load a missing attributes file" do
|
904
|
-
|
935
|
+
expect { node.include_attribute("nope-this::doesnt-exist") }.to raise_error(Chef::Exceptions::CookbookNotFound)
|
905
936
|
end
|
906
937
|
end
|
907
938
|
|
908
939
|
describe "roles" do
|
909
940
|
it "should allow you to query whether or not it has a recipe applied with role?" do
|
910
941
|
node.run_list << "role[sunrise]"
|
911
|
-
node.role?("sunrise").
|
912
|
-
node.role?("not at home").
|
942
|
+
expect(node.role?("sunrise")).to eql(true)
|
943
|
+
expect(node.role?("not at home")).to eql(false)
|
913
944
|
end
|
914
945
|
|
915
946
|
it "should allow you to set roles with arguments" do
|
916
947
|
node.run_list << "role[one]"
|
917
948
|
node.run_list << "role[two]"
|
918
|
-
node.role?("one").
|
919
|
-
node.role?("two").
|
949
|
+
expect(node.role?("one")).to eql(true)
|
950
|
+
expect(node.role?("two")).to eql(true)
|
920
951
|
end
|
921
952
|
end
|
922
953
|
|
923
954
|
describe "run_list" do
|
924
955
|
it "should have a Chef::RunList of recipes and roles that should be applied" do
|
925
|
-
node.run_list.
|
956
|
+
expect(node.run_list).to be_a_kind_of(Chef::RunList)
|
926
957
|
end
|
927
958
|
|
928
959
|
it "should allow you to query the run list with arguments" do
|
929
960
|
node.run_list "recipe[baz]"
|
930
|
-
node.run_list?("recipe[baz]").
|
961
|
+
expect(node.run_list?("recipe[baz]")).to eql(true)
|
931
962
|
end
|
932
963
|
|
933
964
|
it "should allow you to set the run list with arguments" do
|
934
965
|
node.run_list "recipe[baz]", "role[foo]"
|
935
|
-
node.run_list?("recipe[baz]").
|
936
|
-
node.run_list?("role[foo]").
|
966
|
+
expect(node.run_list?("recipe[baz]")).to eql(true)
|
967
|
+
expect(node.run_list?("role[foo]")).to eql(true)
|
937
968
|
end
|
938
969
|
end
|
939
970
|
|
940
971
|
describe "from file" do
|
941
972
|
it "should load a node from a ruby file" do
|
942
973
|
node.from_file(File.expand_path(File.join(CHEF_SPEC_DATA, "nodes", "test.rb")))
|
943
|
-
node.name.
|
944
|
-
node.sunshine.
|
945
|
-
node.something.
|
946
|
-
node.run_list.
|
974
|
+
expect(node.name).to eql("test.example.com-short")
|
975
|
+
expect(node.sunshine).to eql("in")
|
976
|
+
expect(node.something).to eql("else")
|
977
|
+
expect(node.run_list).to eq(["operations-master", "operations-monitoring"])
|
947
978
|
end
|
948
979
|
|
949
980
|
it "should raise an exception if the file cannot be found or read" do
|
950
|
-
|
981
|
+
expect { node.from_file("/tmp/monkeydiving") }.to raise_error(IOError)
|
951
982
|
end
|
952
983
|
end
|
953
984
|
|
@@ -975,16 +1006,16 @@ describe Chef::Node do
|
|
975
1006
|
|
976
1007
|
it "allows update of everything except name" do
|
977
1008
|
node.update_from!(@example)
|
978
|
-
node.name.
|
979
|
-
node.chef_environment.
|
980
|
-
node.default_attrs.
|
981
|
-
node.override_attrs.
|
982
|
-
node.normal_attrs.
|
983
|
-
node.run_list.
|
1009
|
+
expect(node.name).to eq("orig")
|
1010
|
+
expect(node.chef_environment).to eq(@example.chef_environment)
|
1011
|
+
expect(node.default_attrs).to eq(@example.default_attrs)
|
1012
|
+
expect(node.override_attrs).to eq(@example.override_attrs)
|
1013
|
+
expect(node.normal_attrs).to eq(@example.normal_attrs)
|
1014
|
+
expect(node.run_list).to eq(@example.run_list)
|
984
1015
|
end
|
985
1016
|
|
986
1017
|
it "should not update the name of the node" do
|
987
|
-
node.
|
1018
|
+
expect(node).not_to receive(:name).with(@example.name)
|
988
1019
|
node.update_from!(@example)
|
989
1020
|
end
|
990
1021
|
end
|
@@ -999,19 +1030,19 @@ describe Chef::Node do
|
|
999
1030
|
node.run_list << "role[leninist]"
|
1000
1031
|
node.run_list << "recipe[stalinist]"
|
1001
1032
|
h = node.to_hash
|
1002
|
-
h["one"]["two"].
|
1003
|
-
h["one"]["four"].
|
1004
|
-
h["one"]["eight"].
|
1005
|
-
h["role"].
|
1006
|
-
h["role"].
|
1007
|
-
h["run_list"].
|
1008
|
-
h["run_list"].
|
1009
|
-
h["run_list"].
|
1010
|
-
h["chef_environment"].
|
1033
|
+
expect(h["one"]["two"]).to eq("three")
|
1034
|
+
expect(h["one"]["four"]).to eq("six")
|
1035
|
+
expect(h["one"]["eight"]).to eq("nine")
|
1036
|
+
expect(h["role"]).to be_include("marxist")
|
1037
|
+
expect(h["role"]).to be_include("leninist")
|
1038
|
+
expect(h["run_list"]).to be_include("role[marxist]")
|
1039
|
+
expect(h["run_list"]).to be_include("role[leninist]")
|
1040
|
+
expect(h["run_list"]).to be_include("recipe[stalinist]")
|
1041
|
+
expect(h["chef_environment"]).to eq("dev")
|
1011
1042
|
end
|
1012
1043
|
|
1013
1044
|
it 'should return an empty array for empty run_list' do
|
1014
|
-
node.to_hash["run_list"].
|
1045
|
+
expect(node.to_hash["run_list"]).to eq([])
|
1015
1046
|
end
|
1016
1047
|
end
|
1017
1048
|
|
@@ -1019,13 +1050,13 @@ describe Chef::Node do
|
|
1019
1050
|
it "should serialize itself as json", :json => true do
|
1020
1051
|
node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA))
|
1021
1052
|
json = Chef::JSONCompat.to_json(node)
|
1022
|
-
json.
|
1023
|
-
json.
|
1024
|
-
json.
|
1025
|
-
json.
|
1026
|
-
json.
|
1027
|
-
json.
|
1028
|
-
json.
|
1053
|
+
expect(json).to match(/json_class/)
|
1054
|
+
expect(json).to match(/name/)
|
1055
|
+
expect(json).to match(/chef_environment/)
|
1056
|
+
expect(json).to match(/normal/)
|
1057
|
+
expect(json).to match(/default/)
|
1058
|
+
expect(json).to match(/override/)
|
1059
|
+
expect(json).to match(/run_list/)
|
1029
1060
|
end
|
1030
1061
|
|
1031
1062
|
it 'should serialize valid json with a run list', :json => true do
|
@@ -1034,45 +1065,45 @@ describe Chef::Node do
|
|
1034
1065
|
node.run_list << {"type" => "role", "name" => 'Cthulu'}
|
1035
1066
|
node.run_list << {"type" => "role", "name" => 'Hastur'}
|
1036
1067
|
json = Chef::JSONCompat.to_json(node)
|
1037
|
-
json.
|
1068
|
+
expect(json).to match(/\"run_list\":\[\"role\[Cthulu\]\",\"role\[Hastur\]\"\]/)
|
1038
1069
|
end
|
1039
1070
|
|
1040
1071
|
it "should serialize the correct run list", :json => true do
|
1041
1072
|
node.run_list << "role[marxist]"
|
1042
1073
|
node.run_list << "role[leninist]"
|
1043
1074
|
node.override_runlist << "role[stalinist]"
|
1044
|
-
node.run_list.
|
1075
|
+
expect(node.run_list).to be_include("role[stalinist]")
|
1045
1076
|
json = Chef::JSONCompat.to_json(node)
|
1046
|
-
json.
|
1077
|
+
expect(json).to match(/\"run_list\":\[\"role\[marxist\]\",\"role\[leninist\]\"\]/)
|
1047
1078
|
end
|
1048
1079
|
|
1049
1080
|
it "merges the override components into a combined override object" do
|
1050
1081
|
node.attributes.role_override["role override"] = "role override"
|
1051
1082
|
node.attributes.env_override["env override"] = "env override"
|
1052
1083
|
node_for_json = node.for_json
|
1053
|
-
node_for_json["override"]["role override"].
|
1054
|
-
node_for_json["override"]["env override"].
|
1084
|
+
expect(node_for_json["override"]["role override"]).to eq("role override")
|
1085
|
+
expect(node_for_json["override"]["env override"]).to eq("env override")
|
1055
1086
|
end
|
1056
1087
|
|
1057
1088
|
it "merges the default components into a combined default object" do
|
1058
1089
|
node.attributes.role_default["role default"] = "role default"
|
1059
1090
|
node.attributes.env_default["env default"] = "env default"
|
1060
1091
|
node_for_json = node.for_json
|
1061
|
-
node_for_json["default"]["role default"].
|
1062
|
-
node_for_json["default"]["env default"].
|
1092
|
+
expect(node_for_json["default"]["role default"]).to eq("role default")
|
1093
|
+
expect(node_for_json["default"]["env default"]).to eq("env default")
|
1063
1094
|
end
|
1064
1095
|
|
1065
1096
|
it "should deserialize itself from json", :json => true do
|
1066
1097
|
node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA))
|
1067
1098
|
json = Chef::JSONCompat.to_json(node)
|
1068
1099
|
serialized_node = Chef::JSONCompat.from_json(json)
|
1069
|
-
serialized_node.
|
1070
|
-
serialized_node.name.
|
1071
|
-
serialized_node.chef_environment.
|
1100
|
+
expect(serialized_node).to be_a_kind_of(Chef::Node)
|
1101
|
+
expect(serialized_node.name).to eql(node.name)
|
1102
|
+
expect(serialized_node.chef_environment).to eql(node.chef_environment)
|
1072
1103
|
node.each_attribute do |k,v|
|
1073
|
-
serialized_node[k].
|
1104
|
+
expect(serialized_node[k]).to eql(v)
|
1074
1105
|
end
|
1075
|
-
serialized_node.run_list.
|
1106
|
+
expect(serialized_node.run_list).to eq(node.run_list)
|
1076
1107
|
end
|
1077
1108
|
|
1078
1109
|
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
|
@@ -1086,45 +1117,45 @@ describe Chef::Node do
|
|
1086
1117
|
describe "to_s" do
|
1087
1118
|
it "should turn into a string like node[name]" do
|
1088
1119
|
node.name("airplane")
|
1089
|
-
node.to_s.
|
1120
|
+
expect(node.to_s).to eql("node[airplane]")
|
1090
1121
|
end
|
1091
1122
|
end
|
1092
1123
|
|
1093
1124
|
describe "api model" do
|
1094
1125
|
before(:each) do
|
1095
1126
|
@rest = double("Chef::REST")
|
1096
|
-
Chef::REST.
|
1127
|
+
allow(Chef::REST).to receive(:new).and_return(@rest)
|
1097
1128
|
@query = double("Chef::Search::Query")
|
1098
|
-
Chef::Search::Query.
|
1129
|
+
allow(Chef::Search::Query).to receive(:new).and_return(@query)
|
1099
1130
|
end
|
1100
1131
|
|
1101
1132
|
describe "list" do
|
1102
1133
|
describe "inflated" do
|
1103
1134
|
it "should return a hash of node names and objects" do
|
1104
1135
|
n1 = double("Chef::Node", :name => "one")
|
1105
|
-
@query.
|
1136
|
+
expect(@query).to receive(:search).with(:node).and_yield(n1)
|
1106
1137
|
r = Chef::Node.list(true)
|
1107
|
-
r["one"].
|
1138
|
+
expect(r["one"]).to eq(n1)
|
1108
1139
|
end
|
1109
1140
|
end
|
1110
1141
|
|
1111
1142
|
it "should return a hash of node names and urls" do
|
1112
|
-
@rest.
|
1143
|
+
expect(@rest).to receive(:get_rest).and_return({ "one" => "http://foo" })
|
1113
1144
|
r = Chef::Node.list
|
1114
|
-
r["one"].
|
1145
|
+
expect(r["one"]).to eq("http://foo")
|
1115
1146
|
end
|
1116
1147
|
end
|
1117
1148
|
|
1118
1149
|
describe "load" do
|
1119
1150
|
it "should load a node by name" do
|
1120
|
-
@rest.
|
1121
|
-
Chef::Node.load("monkey").
|
1151
|
+
expect(@rest).to receive(:get_rest).with("nodes/monkey").and_return("foo")
|
1152
|
+
expect(Chef::Node.load("monkey")).to eq("foo")
|
1122
1153
|
end
|
1123
1154
|
end
|
1124
1155
|
|
1125
1156
|
describe "destroy" do
|
1126
1157
|
it "should destroy a node" do
|
1127
|
-
@rest.
|
1158
|
+
expect(@rest).to receive(:delete_rest).with("nodes/monkey").and_return("foo")
|
1128
1159
|
node.name("monkey")
|
1129
1160
|
node.destroy
|
1130
1161
|
end
|
@@ -1133,25 +1164,25 @@ describe Chef::Node do
|
|
1133
1164
|
describe "save" do
|
1134
1165
|
it "should update a node if it already exists" do
|
1135
1166
|
node.name("monkey")
|
1136
|
-
node.
|
1137
|
-
@rest.
|
1167
|
+
allow(node).to receive(:data_for_save).and_return({})
|
1168
|
+
expect(@rest).to receive(:put_rest).with("nodes/monkey", {}).and_return("foo")
|
1138
1169
|
node.save
|
1139
1170
|
end
|
1140
1171
|
|
1141
1172
|
it "should not try and create if it can update" do
|
1142
1173
|
node.name("monkey")
|
1143
|
-
node.
|
1144
|
-
@rest.
|
1145
|
-
@rest.
|
1174
|
+
allow(node).to receive(:data_for_save).and_return({})
|
1175
|
+
expect(@rest).to receive(:put_rest).with("nodes/monkey", {}).and_return("foo")
|
1176
|
+
expect(@rest).not_to receive(:post_rest)
|
1146
1177
|
node.save
|
1147
1178
|
end
|
1148
1179
|
|
1149
1180
|
it "should create if it cannot update" do
|
1150
1181
|
node.name("monkey")
|
1151
|
-
node.
|
1182
|
+
allow(node).to receive(:data_for_save).and_return({})
|
1152
1183
|
exception = double("404 error", :code => "404")
|
1153
|
-
@rest.
|
1154
|
-
@rest.
|
1184
|
+
expect(@rest).to receive(:put_rest).and_raise(Net::HTTPServerException.new("foo", exception))
|
1185
|
+
expect(@rest).to receive(:post_rest).with("nodes", {})
|
1155
1186
|
node.save
|
1156
1187
|
end
|
1157
1188
|
|
@@ -1164,8 +1195,8 @@ describe Chef::Node do
|
|
1164
1195
|
end
|
1165
1196
|
it "should not save" do
|
1166
1197
|
node.name("monkey")
|
1167
|
-
@rest.
|
1168
|
-
@rest.
|
1198
|
+
expect(@rest).not_to receive(:put_rest)
|
1199
|
+
expect(@rest).not_to receive(:post_rest)
|
1169
1200
|
node.save
|
1170
1201
|
end
|
1171
1202
|
end
|
@@ -1208,8 +1239,8 @@ describe Chef::Node do
|
|
1208
1239
|
}
|
1209
1240
|
|
1210
1241
|
node.name("picky-monkey")
|
1211
|
-
node.
|
1212
|
-
@rest.
|
1242
|
+
allow(node).to receive(:for_json).and_return(data)
|
1243
|
+
expect(@rest).to receive(:put_rest).with("nodes/picky-monkey", selected_data).and_return("foo")
|
1213
1244
|
node.save
|
1214
1245
|
end
|
1215
1246
|
|
@@ -1265,8 +1296,8 @@ describe Chef::Node do
|
|
1265
1296
|
}
|
1266
1297
|
|
1267
1298
|
node.name("picky-monkey")
|
1268
|
-
node.
|
1269
|
-
@rest.
|
1299
|
+
allow(node).to receive(:for_json).and_return(data)
|
1300
|
+
expect(@rest).to receive(:put_rest).with("nodes/picky-monkey", selected_data).and_return("foo")
|
1270
1301
|
node.save
|
1271
1302
|
end
|
1272
1303
|
end
|