chefspec 7.0.0 → 9.3.8
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 +5 -5
- data/Gemfile +28 -10
- data/Rakefile +74 -18
- data/chefspec.gemspec +26 -28
- data/lib/chefspec/api/core.rb +217 -0
- data/lib/chefspec/api/described.rb +53 -0
- data/lib/chefspec/api/do_nothing.rb +23 -21
- data/lib/chefspec/api/include_any_recipe.rb +24 -0
- data/lib/chefspec/api/include_recipe.rb +25 -23
- data/lib/chefspec/api/link.rb +24 -98
- data/lib/chefspec/api/notifications.rb +37 -35
- data/lib/chefspec/api/reboot.rb +9 -13
- data/lib/chefspec/api/render_file.rb +34 -32
- data/lib/chefspec/api/state_attrs.rb +27 -25
- data/lib/chefspec/api/stubs.rb +183 -0
- data/lib/chefspec/api/stubs_for.rb +139 -0
- data/lib/chefspec/api/subscriptions.rb +34 -32
- data/lib/chefspec/api/user.rb +221 -219
- data/lib/chefspec/api.rb +32 -89
- data/lib/chefspec/berkshelf.rb +5 -5
- data/lib/chefspec/cacher.rb +2 -2
- data/lib/chefspec/coverage/filters.rb +18 -15
- data/lib/chefspec/coverage.rb +36 -40
- data/lib/chefspec/deprecations.rb +5 -14
- data/lib/chefspec/errors.rb +8 -7
- data/lib/chefspec/expect_exception.rb +2 -1
- data/lib/chefspec/extensions/chef/client.rb +6 -7
- data/lib/chefspec/extensions/chef/conditional.rb +5 -3
- data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +33 -0
- data/lib/chefspec/extensions/chef/cookbook_loader.rb +14 -0
- data/lib/chefspec/extensions/chef/cookbook_uploader.rb +4 -3
- data/lib/chefspec/extensions/chef/data_query.rb +8 -11
- data/lib/chefspec/extensions/chef/lwrp_base.rb +18 -21
- data/lib/chefspec/extensions/chef/provider.rb +39 -0
- data/lib/chefspec/extensions/chef/resource/freebsd_package.rb +15 -17
- data/lib/chefspec/extensions/chef/resource.rb +148 -9
- data/lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb +84 -0
- data/lib/chefspec/extensions/chef/securable.rb +1 -1
- data/lib/chefspec/extensions/ohai/system.rb +11 -0
- data/lib/chefspec/extensions.rb +21 -0
- data/lib/chefspec/file_cache_path_proxy.rb +3 -3
- data/lib/chefspec/formatter.rb +15 -3
- data/lib/chefspec/librarian.rb +7 -6
- data/lib/chefspec/matchers/do_nothing_matcher.rb +15 -15
- data/lib/chefspec/matchers/include_any_recipe_matcher.rb +51 -0
- data/lib/chefspec/matchers/include_recipe_matcher.rb +1 -1
- data/lib/chefspec/matchers/link_to_matcher.rb +2 -2
- data/lib/chefspec/matchers/notifications_matcher.rb +5 -4
- data/lib/chefspec/matchers/render_file_matcher.rb +39 -29
- data/lib/chefspec/matchers/resource_matcher.rb +19 -17
- data/lib/chefspec/matchers.rb +9 -8
- data/lib/chefspec/mixins/normalize.rb +1 -1
- data/lib/chefspec/policyfile.rb +16 -9
- data/lib/chefspec/renderer.rb +4 -4
- data/lib/chefspec/rspec.rb +4 -8
- data/lib/chefspec/runner.rb +8 -0
- data/lib/chefspec/server.rb +1 -1
- data/lib/chefspec/server_methods.rb +9 -9
- data/lib/chefspec/server_runner.rb +21 -17
- data/lib/chefspec/solo_runner.rb +148 -42
- data/lib/chefspec/stubs/command_registry.rb +1 -1
- data/lib/chefspec/stubs/command_stub.rb +1 -1
- data/lib/chefspec/stubs/data_bag_item_registry.rb +1 -1
- data/lib/chefspec/stubs/data_bag_item_stub.rb +1 -1
- data/lib/chefspec/stubs/data_bag_registry.rb +1 -1
- data/lib/chefspec/stubs/data_bag_stub.rb +1 -1
- data/lib/chefspec/stubs/registry.rb +1 -1
- data/lib/chefspec/stubs/search_registry.rb +2 -2
- data/lib/chefspec/stubs/search_stub.rb +2 -2
- data/lib/chefspec/util.rb +7 -7
- data/lib/chefspec/version.rb +1 -1
- data/lib/chefspec/zero_server.rb +23 -21
- data/lib/chefspec.rb +29 -36
- data/spec/spec_helper.rb +3 -4
- data/spec/support/hash.rb +4 -4
- data/spec/unit/cacher_spec.rb +17 -17
- data/spec/unit/coverage/filters_spec.rb +16 -16
- data/spec/unit/deprecations_spec.rb +9 -35
- data/spec/unit/errors_spec.rb +15 -15
- data/spec/unit/expect_exception_spec.rb +9 -9
- data/spec/unit/macros_spec.rb +57 -57
- data/spec/unit/matchers/do_nothing_matcher.rb +1 -1
- data/spec/unit/matchers/include_any_recipe_matcher_spec.rb +52 -0
- data/spec/unit/matchers/include_recipe_matcher_spec.rb +15 -15
- data/spec/unit/matchers/link_to_matcher_spec.rb +18 -18
- data/spec/unit/matchers/notifications_matcher_spec.rb +15 -16
- data/spec/unit/matchers/render_file_matcher_spec.rb +31 -24
- data/spec/unit/matchers/resource_matcher_spec.rb +1 -1
- data/spec/unit/matchers/state_attrs_matcher_spec.rb +24 -24
- data/spec/unit/matchers/subscribes_matcher_spec.rb +27 -29
- data/spec/unit/renderer_spec.rb +36 -36
- data/spec/unit/server_runner_spec.rb +6 -6
- data/spec/unit/solo_runner_spec.rb +70 -70
- data/spec/unit/stubs/command_registry_spec.rb +11 -11
- data/spec/unit/stubs/command_stub_spec.rb +26 -26
- data/spec/unit/stubs/data_bag_item_registry_spec.rb +17 -17
- data/spec/unit/stubs/data_bag_item_stub_spec.rb +14 -14
- data/spec/unit/stubs/data_bag_registry_spec.rb +16 -16
- data/spec/unit/stubs/data_bag_stub_spec.rb +13 -13
- data/spec/unit/stubs/registry_spec.rb +9 -9
- data/spec/unit/stubs/search_registry_spec.rb +17 -17
- data/spec/unit/stubs/search_stub_spec.rb +14 -14
- data/spec/unit/stubs/stub_spec.rb +22 -22
- data/templates/errors/may_need_to_specify_platform.erb +3 -3
- data/templates/errors/shell_out_not_stubbed.erb +10 -0
- metadata +47 -902
- data/.gitignore +0 -16
- data/.travis.yml +0 -32
- data/CHANGELOG.md +0 -777
- data/CONTRIBUTING.md +0 -52
- data/ISSUES.md +0 -41
- data/README.md +0 -1230
- data/examples/apt_package/recipes/install.rb +0 -13
- data/examples/apt_package/recipes/purge.rb +0 -13
- data/examples/apt_package/recipes/reconfig.rb +0 -13
- data/examples/apt_package/recipes/remove.rb +0 -13
- data/examples/apt_package/recipes/upgrade.rb +0 -13
- data/examples/apt_package/spec/install_spec.rb +0 -26
- data/examples/apt_package/spec/purge_spec.rb +0 -22
- data/examples/apt_package/spec/reconfig_spec.rb +0 -22
- data/examples/apt_package/spec/remove_spec.rb +0 -22
- data/examples/apt_package/spec/upgrade_spec.rb +0 -22
- data/examples/apt_repository/recipes/add.rb +0 -8
- data/examples/apt_repository/recipes/remove.rb +0 -4
- data/examples/apt_repository/spec/add_spec.rb +0 -17
- data/examples/apt_repository/spec/remove_spec.rb +0 -12
- data/examples/apt_update/recipes/periodic.rb +0 -5
- data/examples/apt_update/recipes/update.rb +0 -3
- data/examples/apt_update/spec/periodic_spec.rb +0 -17
- data/examples/apt_update/spec/update_spec.rb +0 -12
- data/examples/attributes/attributes/default.rb +0 -1
- data/examples/attributes/recipes/default.rb +0 -4
- data/examples/attributes/spec/default_spec.rb +0 -20
- data/examples/batch/recipes/run.rb +0 -9
- data/examples/batch/spec/run_spec.rb +0 -22
- data/examples/bff_package/recipes/install.rb +0 -13
- data/examples/bff_package/recipes/purge.rb +0 -13
- data/examples/bff_package/recipes/remove.rb +0 -13
- data/examples/bff_package/recipes/upgrade.rb +0 -13
- data/examples/bff_package/spec/install_spec.rb +0 -23
- data/examples/bff_package/spec/purge_spec.rb +0 -19
- data/examples/bff_package/spec/remove_spec.rb +0 -19
- data/examples/bff_package/spec/upgrade_spec.rb +0 -19
- data/examples/cab_package/recipes/install.rb +0 -13
- data/examples/cab_package/recipes/remove.rb +0 -13
- data/examples/cab_package/spec/install_spec.rb +0 -26
- data/examples/cab_package/spec/remove_spec.rb +0 -22
- data/examples/cached/recipes/default.rb +0 -1
- data/examples/cached/spec/default_spec.rb +0 -13
- data/examples/chef_gem/recipes/install.rb +0 -18
- data/examples/chef_gem/recipes/purge.rb +0 -16
- data/examples/chef_gem/recipes/reconfig.rb +0 -16
- data/examples/chef_gem/recipes/remove.rb +0 -16
- data/examples/chef_gem/recipes/upgrade.rb +0 -16
- data/examples/chef_gem/spec/install_spec.rb +0 -23
- data/examples/chef_gem/spec/purge_spec.rb +0 -19
- data/examples/chef_gem/spec/reconfig_spec.rb +0 -19
- data/examples/chef_gem/spec/remove_spec.rb +0 -19
- data/examples/chef_gem/spec/upgrade_spec.rb +0 -19
- data/examples/chocolatey_package/recipes/install.rb +0 -6
- data/examples/chocolatey_package/recipes/remove.rb +0 -8
- data/examples/chocolatey_package/recipes/upgrade.rb +0 -8
- data/examples/chocolatey_package/spec/install_spec.rb +0 -19
- data/examples/chocolatey_package/spec/remove_spec.rb +0 -18
- data/examples/chocolatey_package/spec/upgrade_spec.rb +0 -18
- data/examples/compile_time/recipes/default.rb +0 -3
- data/examples/compile_time/spec/default_spec.rb +0 -27
- data/examples/cookbook_file/recipes/create.rb +0 -15
- data/examples/cookbook_file/recipes/create_if_missing.rb +0 -15
- data/examples/cookbook_file/recipes/delete.rb +0 -15
- data/examples/cookbook_file/recipes/touch.rb +0 -15
- data/examples/cookbook_file/spec/create_if_missing_spec.rb +0 -28
- data/examples/cookbook_file/spec/create_spec.rb +0 -32
- data/examples/cookbook_file/spec/delete_spec.rb +0 -19
- data/examples/cookbook_file/spec/touch_spec.rb +0 -19
- data/examples/cron/recipes/create.rb +0 -10
- data/examples/cron/recipes/delete.rb +0 -9
- data/examples/cron/spec/create_spec.rb +0 -19
- data/examples/cron/spec/delete_spec.rb +0 -15
- data/examples/custom_matcher/libraries/matcher.rb +0 -23
- data/examples/custom_matcher/providers/thing.rb +0 -2
- data/examples/custom_matcher/recipes/install.rb +0 -13
- data/examples/custom_matcher/recipes/remove.rb +0 -13
- data/examples/custom_matcher/resources/thing.rb +0 -5
- data/examples/custom_matcher/spec/install_spec.rb +0 -27
- data/examples/custom_matcher/spec/remove_spec.rb +0 -23
- data/examples/custom_resource/libraries/matchers.rb +0 -5
- data/examples/custom_resource/recipes/default.rb +0 -1
- data/examples/custom_resource/resources/custom_resource.rb +0 -9
- data/examples/custom_resource/spec/default_spec.rb +0 -18
- data/examples/deploy/recipes/deploy.rb +0 -10
- data/examples/deploy/recipes/force_deploy.rb +0 -9
- data/examples/deploy/recipes/rollback.rb +0 -9
- data/examples/deploy/spec/deploy_spec.rb +0 -15
- data/examples/deploy/spec/force_deploy_spec.rb +0 -15
- data/examples/deploy/spec/rollback_spec.rb +0 -15
- data/examples/directory/recipes/create.rb +0 -18
- data/examples/directory/recipes/delete.rb +0 -14
- data/examples/directory/spec/create_spec.rb +0 -34
- data/examples/directory/spec/delete_spec.rb +0 -26
- data/examples/dnf_package/recipes/install.rb +0 -13
- data/examples/dnf_package/recipes/purge.rb +0 -13
- data/examples/dnf_package/recipes/remove.rb +0 -13
- data/examples/dnf_package/recipes/upgrade.rb +0 -13
- data/examples/dnf_package/spec/install_spec.rb +0 -26
- data/examples/dnf_package/spec/purge_spec.rb +0 -22
- data/examples/dnf_package/spec/remove_spec.rb +0 -22
- data/examples/dnf_package/spec/upgrade_spec.rb +0 -22
- data/examples/do_nothing/recipes/default.rb +0 -3
- data/examples/do_nothing/spec/default_spec.rb +0 -15
- data/examples/dpkg_package/recipes/install.rb +0 -13
- data/examples/dpkg_package/recipes/purge.rb +0 -13
- data/examples/dpkg_package/recipes/remove.rb +0 -13
- data/examples/dpkg_package/spec/install_spec.rb +0 -26
- data/examples/dpkg_package/spec/purge_spec.rb +0 -22
- data/examples/dpkg_package/spec/remove_spec.rb +0 -22
- data/examples/dsc_resource/recipes/run.rb +0 -20
- data/examples/dsc_resource/spec/run_spec.rb +0 -38
- data/examples/dsc_script/recipes/run.rb +0 -12
- data/examples/dsc_script/spec/run_spec.rb +0 -16
- data/examples/env/recipes/create.rb +0 -13
- data/examples/env/recipes/delete.rb +0 -13
- data/examples/env/recipes/modify.rb +0 -13
- data/examples/env/spec/create_spec.rb +0 -26
- data/examples/env/spec/delete_spec.rb +0 -22
- data/examples/env/spec/modify_spec.rb +0 -22
- data/examples/erl_call/recipes/run.rb +0 -13
- data/examples/erl_call/spec/run_spec.rb +0 -23
- data/examples/execute/recipes/run.rb +0 -13
- data/examples/execute/spec/run_spec.rb +0 -23
- data/examples/expect_exception/recipes/compile_error.rb +0 -1
- data/examples/expect_exception/recipes/converge_error.rb +0 -5
- data/examples/expect_exception/recipes/no_error.rb +0 -1
- data/examples/expect_exception/spec/compile_error_spec.rb +0 -10
- data/examples/expect_exception/spec/converge_error_spec.rb +0 -10
- data/examples/expect_exception/spec/no_error_spec.rb +0 -10
- data/examples/file/recipes/create.rb +0 -15
- data/examples/file/recipes/create_if_missing.rb +0 -15
- data/examples/file/recipes/delete.rb +0 -15
- data/examples/file/recipes/touch.rb +0 -15
- data/examples/file/spec/create_if_missing_spec.rb +0 -28
- data/examples/file/spec/create_spec.rb +0 -32
- data/examples/file/spec/delete_spec.rb +0 -19
- data/examples/file/spec/touch_spec.rb +0 -19
- data/examples/freebsd_package/recipes/install.rb +0 -13
- data/examples/freebsd_package/recipes/remove.rb +0 -13
- data/examples/freebsd_package/spec/install_spec.rb +0 -26
- data/examples/freebsd_package/spec/remove_spec.rb +0 -22
- data/examples/gem_package/recipes/install.rb +0 -13
- data/examples/gem_package/recipes/purge.rb +0 -13
- data/examples/gem_package/recipes/reconfig.rb +0 -13
- data/examples/gem_package/recipes/remove.rb +0 -13
- data/examples/gem_package/recipes/upgrade.rb +0 -13
- data/examples/gem_package/spec/install_spec.rb +0 -23
- data/examples/gem_package/spec/purge_spec.rb +0 -19
- data/examples/gem_package/spec/reconfig_spec.rb +0 -19
- data/examples/gem_package/spec/remove_spec.rb +0 -19
- data/examples/gem_package/spec/upgrade_spec.rb +0 -19
- data/examples/git/recipes/checkout.rb +0 -13
- data/examples/git/recipes/export.rb +0 -13
- data/examples/git/recipes/sync.rb +0 -13
- data/examples/git/spec/checkout_spec.rb +0 -19
- data/examples/git/spec/export_spec.rb +0 -19
- data/examples/git/spec/sync_spec.rb +0 -23
- data/examples/group/recipes/create.rb +0 -13
- data/examples/group/recipes/manage.rb +0 -13
- data/examples/group/recipes/modify.rb +0 -13
- data/examples/group/recipes/remove.rb +0 -13
- data/examples/group/spec/create_spec.rb +0 -23
- data/examples/group/spec/manage_spec.rb +0 -19
- data/examples/group/spec/modify_spec.rb +0 -19
- data/examples/group/spec/remove_spec.rb +0 -18
- data/examples/guards/recipes/default.rb +0 -13
- data/examples/guards/spec/default_spec.rb +0 -17
- data/examples/heavy_provider_light_resource/libraries/resource_service.rb +0 -15
- data/examples/heavy_provider_light_resource/providers/service.rb +0 -9
- data/examples/heavy_provider_light_resource/recipes/default.rb +0 -3
- data/examples/heavy_provider_light_resource/spec/provider_service_spec.rb +0 -7
- data/examples/homebrew_package/recipes/install.rb +0 -13
- data/examples/homebrew_package/recipes/purge.rb +0 -13
- data/examples/homebrew_package/recipes/remove.rb +0 -13
- data/examples/homebrew_package/recipes/upgrade.rb +0 -13
- data/examples/homebrew_package/spec/install_spec.rb +0 -23
- data/examples/homebrew_package/spec/purge_spec.rb +0 -19
- data/examples/homebrew_package/spec/remove_spec.rb +0 -19
- data/examples/homebrew_package/spec/upgrade_spec.rb +0 -19
- data/examples/http_request/recipes/delete.rb +0 -13
- data/examples/http_request/recipes/get.rb +0 -13
- data/examples/http_request/recipes/head.rb +0 -13
- data/examples/http_request/recipes/options.rb +0 -13
- data/examples/http_request/recipes/post.rb +0 -13
- data/examples/http_request/recipes/put.rb +0 -13
- data/examples/http_request/spec/delete_spec.rb +0 -19
- data/examples/http_request/spec/get_spec.rb +0 -23
- data/examples/http_request/spec/head_spec.rb +0 -19
- data/examples/http_request/spec/options_spec.rb +0 -19
- data/examples/http_request/spec/post_spec.rb +0 -19
- data/examples/http_request/spec/put_spec.rb +0 -19
- data/examples/ifconfig/recipes/add.rb +0 -9
- data/examples/ifconfig/recipes/delete.rb +0 -8
- data/examples/ifconfig/recipes/disable.rb +0 -8
- data/examples/ifconfig/recipes/enable.rb +0 -8
- data/examples/ifconfig/spec/add_spec.rb +0 -19
- data/examples/ifconfig/spec/delete_spec.rb +0 -15
- data/examples/ifconfig/spec/disable_spec.rb +0 -15
- data/examples/ifconfig/spec/enable_spec.rb +0 -15
- data/examples/include_recipe/recipes/default.rb +0 -1
- data/examples/include_recipe/recipes/not.rb +0 -0
- data/examples/include_recipe/recipes/other.rb +0 -0
- data/examples/include_recipe/spec/default_spec.rb +0 -13
- data/examples/ips_package/recipes/install.rb +0 -13
- data/examples/ips_package/recipes/remove.rb +0 -13
- data/examples/ips_package/recipes/upgrade.rb +0 -13
- data/examples/ips_package/spec/install_spec.rb +0 -26
- data/examples/ips_package/spec/remove_spec.rb +0 -22
- data/examples/ips_package/spec/upgrade_spec.rb +0 -22
- data/examples/launchd/recipes/create.rb +0 -5
- data/examples/launchd/recipes/create_if_missing.rb +0 -3
- data/examples/launchd/recipes/delete.rb +0 -3
- data/examples/launchd/recipes/disable.rb +0 -3
- data/examples/launchd/recipes/enable.rb +0 -3
- data/examples/launchd/spec/create_if_missing_spec.rb +0 -10
- data/examples/launchd/spec/create_spec.rb +0 -14
- data/examples/launchd/spec/delete_spec.rb +0 -10
- data/examples/launchd/spec/disable_spec.rb +0 -10
- data/examples/launchd/spec/enable_spec.rb +0 -10
- data/examples/link/recipes/create.rb +0 -13
- data/examples/link/recipes/delete.rb +0 -13
- data/examples/link/recipes/link_to.rb +0 -3
- data/examples/link/spec/create_spec.rb +0 -23
- data/examples/link/spec/delete_spec.rb +0 -19
- data/examples/link/spec/link_to_spec.rb +0 -11
- data/examples/log/recipes/write.rb +0 -14
- data/examples/log/spec/write_spec.rb +0 -24
- data/examples/macports_package/recipes/install.rb +0 -13
- data/examples/macports_package/recipes/purge.rb +0 -13
- data/examples/macports_package/recipes/remove.rb +0 -13
- data/examples/macports_package/recipes/upgrade.rb +0 -13
- data/examples/macports_package/spec/install_spec.rb +0 -23
- data/examples/macports_package/spec/purge_spec.rb +0 -19
- data/examples/macports_package/spec/remove_spec.rb +0 -19
- data/examples/macports_package/spec/upgrade_spec.rb +0 -19
- data/examples/mdadm/recipes/assemble.rb +0 -13
- data/examples/mdadm/recipes/create.rb +0 -13
- data/examples/mdadm/recipes/stop.rb +0 -13
- data/examples/mdadm/spec/assemble_spec.rb +0 -19
- data/examples/mdadm/spec/create_spec.rb +0 -23
- data/examples/mdadm/spec/stop_spec.rb +0 -19
- data/examples/mount/recipes/disable.rb +0 -8
- data/examples/mount/recipes/enable.rb +0 -8
- data/examples/mount/recipes/mount.rb +0 -9
- data/examples/mount/recipes/remount.rb +0 -8
- data/examples/mount/recipes/umount.rb +0 -8
- data/examples/mount/spec/disable_spec.rb +0 -15
- data/examples/mount/spec/enable_spec.rb +0 -15
- data/examples/mount/spec/mount_spec.rb +0 -19
- data/examples/mount/spec/remount_spec.rb +0 -15
- data/examples/mount/spec/umount_spec.rb +0 -15
- data/examples/msu_package/recipes/install.rb +0 -13
- data/examples/msu_package/recipes/remove.rb +0 -13
- data/examples/msu_package/spec/install_spec.rb +0 -26
- data/examples/msu_package/spec/remove_spec.rb +0 -22
- data/examples/multiple_actions/recipes/default.rb +0 -3
- data/examples/multiple_actions/recipes/reversed.rb +0 -9
- data/examples/multiple_actions/recipes/sequential.rb +0 -9
- data/examples/multiple_actions/spec/default_spec.rb +0 -14
- data/examples/multiple_actions/spec/reversed_spec.rb +0 -17
- data/examples/multiple_actions/spec/sequential_spec.rb +0 -17
- data/examples/multiple_run_action/recipes/default.rb +0 -5
- data/examples/multiple_run_action/spec/default_spec.rb +0 -18
- data/examples/notifications/recipes/before.rb +0 -7
- data/examples/notifications/recipes/chained.rb +0 -12
- data/examples/notifications/recipes/default.rb +0 -7
- data/examples/notifications/recipes/delayed.rb +0 -7
- data/examples/notifications/recipes/immediately.rb +0 -7
- data/examples/notifications/spec/before_spec.rb +0 -16
- data/examples/notifications/spec/chained_spec.rb +0 -21
- data/examples/notifications/spec/default_spec.rb +0 -16
- data/examples/notifications/spec/delayed_spec.rb +0 -16
- data/examples/notifications/spec/immediately_spec.rb +0 -16
- data/examples/ohai/recipes/reload.rb +0 -13
- data/examples/ohai/spec/reload_spec.rb +0 -23
- data/examples/openbsd_package/recipes/install.rb +0 -13
- data/examples/openbsd_package/recipes/purge.rb +0 -13
- data/examples/openbsd_package/recipes/remove.rb +0 -13
- data/examples/openbsd_package/recipes/upgrade.rb +0 -13
- data/examples/openbsd_package/spec/install_spec.rb +0 -23
- data/examples/openbsd_package/spec/purge_spec.rb +0 -19
- data/examples/openbsd_package/spec/remove_spec.rb +0 -19
- data/examples/openbsd_package/spec/upgrade_spec.rb +0 -19
- data/examples/osx_profile/recipes/install.rb +0 -8
- data/examples/osx_profile/recipes/remove.rb +0 -8
- data/examples/osx_profile/spec/install_spec.rb +0 -15
- data/examples/osx_profile/spec/remove_spec.rb +0 -13
- data/examples/package/recipes/install.rb +0 -17
- data/examples/package/recipes/purge.rb +0 -17
- data/examples/package/recipes/reconfig.rb +0 -17
- data/examples/package/recipes/remove.rb +0 -17
- data/examples/package/recipes/upgrade.rb +0 -17
- data/examples/package/spec/install_spec.rb +0 -27
- data/examples/package/spec/purge_spec.rb +0 -23
- data/examples/package/spec/reconfig_spec.rb +0 -23
- data/examples/package/spec/remove_spec.rb +0 -23
- data/examples/package/spec/upgrade_spec.rb +0 -23
- data/examples/pacman_package/recipes/install.rb +0 -13
- data/examples/pacman_package/recipes/purge.rb +0 -13
- data/examples/pacman_package/recipes/remove.rb +0 -13
- data/examples/pacman_package/recipes/upgrade.rb +0 -13
- data/examples/pacman_package/spec/install_spec.rb +0 -26
- data/examples/pacman_package/spec/purge_spec.rb +0 -22
- data/examples/pacman_package/spec/remove_spec.rb +0 -22
- data/examples/pacman_package/spec/upgrade_spec.rb +0 -22
- data/examples/paludis_package/recipes/install.rb +0 -13
- data/examples/paludis_package/recipes/purge.rb +0 -13
- data/examples/paludis_package/recipes/remove.rb +0 -13
- data/examples/paludis_package/recipes/upgrade.rb +0 -13
- data/examples/paludis_package/spec/install_spec.rb +0 -23
- data/examples/paludis_package/spec/purge_spec.rb +0 -19
- data/examples/paludis_package/spec/remove_spec.rb +0 -19
- data/examples/paludis_package/spec/upgrade_spec.rb +0 -19
- data/examples/portage_package/recipes/install.rb +0 -13
- data/examples/portage_package/recipes/purge.rb +0 -13
- data/examples/portage_package/recipes/remove.rb +0 -13
- data/examples/portage_package/recipes/upgrade.rb +0 -13
- data/examples/portage_package/spec/install_spec.rb +0 -26
- data/examples/portage_package/spec/purge_spec.rb +0 -22
- data/examples/portage_package/spec/remove_spec.rb +0 -22
- data/examples/portage_package/spec/upgrade_spec.rb +0 -22
- data/examples/powershell_script/recipes/run.rb +0 -9
- data/examples/powershell_script/spec/run_spec.rb +0 -22
- data/examples/reboot/recipes/cancel.rb +0 -3
- data/examples/reboot/recipes/now.rb +0 -3
- data/examples/reboot/recipes/request.rb +0 -3
- data/examples/reboot/spec/cancel_spec.rb +0 -9
- data/examples/reboot/spec/now_spec.rb +0 -9
- data/examples/reboot/spec/request_spec.rb +0 -9
- data/examples/registry_key/recipes/create.rb +0 -13
- data/examples/registry_key/recipes/create_if_missing.rb +0 -13
- data/examples/registry_key/recipes/delete.rb +0 -13
- data/examples/registry_key/recipes/delete_key.rb +0 -13
- data/examples/registry_key/spec/create_if_missing_spec.rb +0 -22
- data/examples/registry_key/spec/create_spec.rb +0 -26
- data/examples/registry_key/spec/delete_key_spec.rb +0 -22
- data/examples/registry_key/spec/delete_spec.rb +0 -22
- data/examples/remote_directory/recipes/create.rb +0 -13
- data/examples/remote_directory/recipes/create_if_missing.rb +0 -13
- data/examples/remote_directory/recipes/delete.rb +0 -13
- data/examples/remote_directory/spec/create_if_missing_spec.rb +0 -19
- data/examples/remote_directory/spec/create_spec.rb +0 -23
- data/examples/remote_directory/spec/delete_spec.rb +0 -19
- data/examples/remote_file/recipes/create.rb +0 -18
- data/examples/remote_file/recipes/create_if_missing.rb +0 -16
- data/examples/remote_file/recipes/delete.rb +0 -16
- data/examples/remote_file/recipes/touch.rb +0 -16
- data/examples/remote_file/spec/create_if_missing_spec.rb +0 -19
- data/examples/remote_file/spec/create_spec.rb +0 -23
- data/examples/remote_file/spec/delete_spec.rb +0 -19
- data/examples/remote_file/spec/touch_spec.rb +0 -19
- data/examples/render_file/files/default/cookbook_file +0 -1
- data/examples/render_file/recipes/default.rb +0 -15
- data/examples/render_file/recipes/template_helpers.rb +0 -9
- data/examples/render_file/spec/default_spec.rb +0 -155
- data/examples/render_file/spec/template_helpers_spec.rb +0 -10
- data/examples/render_file/templates/default/_partial.erb +0 -1
- data/examples/render_file/templates/default/partial.erb +0 -1
- data/examples/render_file/templates/default/template.erb +0 -1
- data/examples/render_file/templates/default/template_with_helper.erb +0 -1
- data/examples/roles/recipes/another.rb +0 -3
- data/examples/roles/recipes/default.rb +0 -1
- data/examples/roles/roles/role.rb +0 -9
- data/examples/roles/spec/default_spec.rb +0 -21
- data/examples/route/recipes/add.rb +0 -13
- data/examples/route/recipes/delete.rb +0 -13
- data/examples/route/spec/add_spec.rb +0 -23
- data/examples/route/spec/delete_spec.rb +0 -19
- data/examples/rpm_package/recipes/install.rb +0 -13
- data/examples/rpm_package/recipes/remove.rb +0 -13
- data/examples/rpm_package/recipes/upgrade.rb +0 -13
- data/examples/rpm_package/spec/install_spec.rb +0 -26
- data/examples/rpm_package/spec/remove_spec.rb +0 -22
- data/examples/rpm_package/spec/upgrade_spec.rb +0 -22
- data/examples/ruby_block/recipes/create.rb +0 -8
- data/examples/ruby_block/recipes/run.rb +0 -9
- data/examples/ruby_block/spec/create_spec.rb +0 -13
- data/examples/ruby_block/spec/run_spec.rb +0 -18
- data/examples/script/recipes/run_bash.rb +0 -9
- data/examples/script/recipes/run_csh.rb +0 -9
- data/examples/script/recipes/run_ksh.rb +0 -9
- data/examples/script/recipes/run_perl.rb +0 -9
- data/examples/script/recipes/run_python.rb +0 -9
- data/examples/script/recipes/run_ruby.rb +0 -9
- data/examples/script/recipes/run_script.rb +0 -9
- data/examples/script/spec/run_bash_spec.rb +0 -19
- data/examples/script/spec/run_csh_spec.rb +0 -19
- data/examples/script/spec/run_ksh_spec.rb +0 -19
- data/examples/script/spec/run_perl_spec.rb +0 -19
- data/examples/script/spec/run_python_spec.rb +0 -19
- data/examples/script/spec/run_ruby_spec.rb +0 -19
- data/examples/script/spec/run_script_spec.rb +0 -19
- data/examples/server/recipes/client.rb +0 -6
- data/examples/server/recipes/data_bag.rb +0 -7
- data/examples/server/recipes/environment.rb +0 -6
- data/examples/server/recipes/node.rb +0 -6
- data/examples/server/recipes/render_with_cached.rb +0 -3
- data/examples/server/recipes/role.rb +0 -6
- data/examples/server/recipes/search.rb +0 -5
- data/examples/server/spec/client_spec.rb +0 -18
- data/examples/server/spec/data_bag_spec.rb +0 -25
- data/examples/server/spec/environment_spec.rb +0 -18
- data/examples/server/spec/exotic_port_spec.rb +0 -17
- data/examples/server/spec/node_spec.rb +0 -49
- data/examples/server/spec/render_with_cached_spec.rb +0 -15
- data/examples/server/spec/role_spec.rb +0 -18
- data/examples/server/spec/search_spec.rb +0 -61
- data/examples/service/recipes/disable.rb +0 -13
- data/examples/service/recipes/enable.rb +0 -13
- data/examples/service/recipes/reload.rb +0 -13
- data/examples/service/recipes/restart.rb +0 -13
- data/examples/service/recipes/start.rb +0 -13
- data/examples/service/recipes/stop.rb +0 -13
- data/examples/service/spec/disable_spec.rb +0 -19
- data/examples/service/spec/enable_spec.rb +0 -19
- data/examples/service/spec/reload_spec.rb +0 -19
- data/examples/service/spec/restart_spec.rb +0 -19
- data/examples/service/spec/start_spec.rb +0 -19
- data/examples/service/spec/stop_spec.rb +0 -19
- data/examples/smartos_package/recipes/install.rb +0 -13
- data/examples/smartos_package/recipes/remove.rb +0 -13
- data/examples/smartos_package/recipes/upgrade.rb +0 -13
- data/examples/smartos_package/spec/install_spec.rb +0 -26
- data/examples/smartos_package/spec/remove_spec.rb +0 -22
- data/examples/smartos_package/spec/upgrade_spec.rb +0 -22
- data/examples/solaris_package/recipes/install.rb +0 -13
- data/examples/solaris_package/recipes/remove.rb +0 -13
- data/examples/solaris_package/recipes/upgrade.rb +0 -13
- data/examples/solaris_package/spec/install_spec.rb +0 -26
- data/examples/solaris_package/spec/remove_spec.rb +0 -22
- data/examples/solaris_package/spec/upgrade_spec.rb +0 -22
- data/examples/state_attrs/providers/lwrp.rb +0 -2
- data/examples/state_attrs/recipes/default.rb +0 -3
- data/examples/state_attrs/resources/lwrp.rb +0 -6
- data/examples/state_attrs/spec/default_spec.rb +0 -12
- data/examples/step_into/providers/lwrp.rb +0 -3
- data/examples/step_into/providers/provides.rb +0 -3
- data/examples/step_into/recipes/default.rb +0 -3
- data/examples/step_into/resources/lwrp.rb +0 -4
- data/examples/step_into/resources/provides.rb +0 -6
- data/examples/step_into/spec/default_spec.rb +0 -30
- data/examples/stub_command/recipes/default.rb +0 -5
- data/examples/stub_command/recipes/other_recipe.rb +0 -3
- data/examples/stub_command/spec/default_spec.rb +0 -28
- data/examples/stub_data_bag/recipes/default.rb +0 -5
- data/examples/stub_data_bag/spec/default_spec.rb +0 -27
- data/examples/stub_data_bag_item/recipes/default.rb +0 -5
- data/examples/stub_data_bag_item/spec/default_spec.rb +0 -27
- data/examples/stub_node/recipes/default.rb +0 -0
- data/examples/stub_node/spec/default_spec.rb +0 -17
- data/examples/stub_search/recipes/block.rb +0 -3
- data/examples/stub_search/recipes/default.rb +0 -2
- data/examples/stub_search/spec/block_spec.rb +0 -27
- data/examples/stub_search/spec/default_spec.rb +0 -27
- data/examples/subscribes/recipes/before.rb +0 -5
- data/examples/subscribes/recipes/chained.rb +0 -10
- data/examples/subscribes/recipes/default.rb +0 -5
- data/examples/subscribes/recipes/delayed.rb +0 -5
- data/examples/subscribes/recipes/immediately.rb +0 -5
- data/examples/subscribes/spec/before_spec.rb +0 -16
- data/examples/subscribes/spec/chained_spec.rb +0 -21
- data/examples/subscribes/spec/default_spec.rb +0 -16
- data/examples/subscribes/spec/delayed_spec.rb +0 -16
- data/examples/subscribes/spec/immediately_spec.rb +0 -16
- data/examples/subversion/recipes/checkout.rb +0 -13
- data/examples/subversion/recipes/export.rb +0 -13
- data/examples/subversion/recipes/force_export.rb +0 -13
- data/examples/subversion/recipes/sync.rb +0 -13
- data/examples/subversion/spec/checkout_spec.rb +0 -19
- data/examples/subversion/spec/export_spec.rb +0 -19
- data/examples/subversion/spec/force_export_spec.rb +0 -19
- data/examples/subversion/spec/sync_spec.rb +0 -23
- data/examples/systemd_unit/recipes/create.rb +0 -3
- data/examples/systemd_unit/recipes/delete.rb +0 -3
- data/examples/systemd_unit/recipes/disable.rb +0 -3
- data/examples/systemd_unit/recipes/enable.rb +0 -3
- data/examples/systemd_unit/recipes/mask.rb +0 -3
- data/examples/systemd_unit/recipes/reload_or_restart.rb +0 -3
- data/examples/systemd_unit/recipes/reload_or_try_restart.rb +0 -3
- data/examples/systemd_unit/recipes/restart.rb +0 -3
- data/examples/systemd_unit/recipes/start.rb +0 -3
- data/examples/systemd_unit/recipes/stop.rb +0 -3
- data/examples/systemd_unit/recipes/try_restart.rb +0 -3
- data/examples/systemd_unit/recipes/unmask.rb +0 -3
- data/examples/systemd_unit/spec/create_spec.rb +0 -10
- data/examples/systemd_unit/spec/delete_spec.rb +0 -10
- data/examples/systemd_unit/spec/disable_spec.rb +0 -10
- data/examples/systemd_unit/spec/enable_spec.rb +0 -10
- data/examples/systemd_unit/spec/mask_spec.rb +0 -10
- data/examples/systemd_unit/spec/reload_or_restart_spec.rb +0 -10
- data/examples/systemd_unit/spec/reload_or_try_restart_spec.rb +0 -10
- data/examples/systemd_unit/spec/restart_spec.rb +0 -10
- data/examples/systemd_unit/spec/start_spec.rb +0 -10
- data/examples/systemd_unit/spec/stop_spec.rb +0 -10
- data/examples/systemd_unit/spec/try_restart_spec.rb +0 -10
- data/examples/systemd_unit/spec/unmask_spec.rb +0 -10
- data/examples/template/recipes/create.rb +0 -15
- data/examples/template/recipes/create_if_missing.rb +0 -15
- data/examples/template/recipes/delete.rb +0 -15
- data/examples/template/recipes/touch.rb +0 -15
- data/examples/template/spec/create_if_missing_spec.rb +0 -28
- data/examples/template/spec/create_spec.rb +0 -32
- data/examples/template/spec/delete_spec.rb +0 -19
- data/examples/template/spec/touch_spec.rb +0 -19
- data/examples/use_inline_resources/libraries/matchers.rb +0 -5
- data/examples/use_inline_resources/providers/lwrp.rb +0 -7
- data/examples/use_inline_resources/recipes/default.rb +0 -1
- data/examples/use_inline_resources/resources/lwrp.rb +0 -4
- data/examples/use_inline_resources/spec/default_spec.rb +0 -18
- data/examples/user/recipes/create.rb +0 -13
- data/examples/user/recipes/lock.rb +0 -13
- data/examples/user/recipes/manage.rb +0 -13
- data/examples/user/recipes/modify.rb +0 -13
- data/examples/user/recipes/remove.rb +0 -13
- data/examples/user/recipes/unlock.rb +0 -13
- data/examples/user/spec/create_spec.rb +0 -26
- data/examples/user/spec/lock_spec.rb +0 -22
- data/examples/user/spec/manage_spec.rb +0 -22
- data/examples/user/spec/modify_spec.rb +0 -22
- data/examples/user/spec/remove_spec.rb +0 -22
- data/examples/user/spec/unlock_spec.rb +0 -22
- data/examples/windows_package/recipes/install.rb +0 -13
- data/examples/windows_package/recipes/remove.rb +0 -13
- data/examples/windows_package/spec/install_spec.rb +0 -22
- data/examples/windows_package/spec/remove_spec.rb +0 -22
- data/examples/windows_service/recipes/configure_startup.rb +0 -13
- data/examples/windows_service/recipes/disable.rb +0 -13
- data/examples/windows_service/recipes/enable.rb +0 -13
- data/examples/windows_service/recipes/reload.rb +0 -13
- data/examples/windows_service/recipes/restart.rb +0 -13
- data/examples/windows_service/recipes/start.rb +0 -13
- data/examples/windows_service/recipes/stop.rb +0 -13
- data/examples/windows_service/spec/configure_startup_spec.rb +0 -22
- data/examples/windows_service/spec/disable_spec.rb +0 -22
- data/examples/windows_service/spec/enable_spec.rb +0 -22
- data/examples/windows_service/spec/reload_spec.rb +0 -22
- data/examples/windows_service/spec/restart_spec.rb +0 -22
- data/examples/windows_service/spec/start_spec.rb +0 -22
- data/examples/windows_service/spec/stop_spec.rb +0 -22
- data/examples/yum_package/recipes/install.rb +0 -13
- data/examples/yum_package/recipes/purge.rb +0 -13
- data/examples/yum_package/recipes/remove.rb +0 -13
- data/examples/yum_package/recipes/upgrade.rb +0 -13
- data/examples/yum_package/spec/install_spec.rb +0 -26
- data/examples/yum_package/spec/purge_spec.rb +0 -22
- data/examples/yum_package/spec/remove_spec.rb +0 -22
- data/examples/yum_package/spec/upgrade_spec.rb +0 -22
- data/examples/yum_repository/recipes/add.rb +0 -8
- data/examples/yum_repository/recipes/create.rb +0 -8
- data/examples/yum_repository/recipes/delete.rb +0 -3
- data/examples/yum_repository/recipes/makecache.rb +0 -3
- data/examples/yum_repository/recipes/remove.rb +0 -7
- data/examples/yum_repository/spec/add_spec.rb +0 -12
- data/examples/yum_repository/spec/create_spec.rb +0 -17
- data/examples/yum_repository/spec/delete_spec.rb +0 -12
- data/examples/yum_repository/spec/makecache_spec.rb +0 -12
- data/examples/yum_repository/spec/remove_spec.rb +0 -12
- data/examples/zypper_package/recipes/install.rb +0 -13
- data/examples/zypper_package/recipes/purge.rb +0 -13
- data/examples/zypper_package/recipes/remove.rb +0 -13
- data/examples/zypper_package/recipes/upgrade.rb +0 -13
- data/examples/zypper_package/spec/install_spec.rb +0 -23
- data/examples/zypper_package/spec/purge_spec.rb +0 -19
- data/examples/zypper_package/spec/remove_spec.rb +0 -19
- data/examples/zypper_package/spec/upgrade_spec.rb +0 -19
- data/features/apt_package.feature +0 -14
- data/features/apt_repository.feature +0 -15
- data/features/apt_update.feature +0 -13
- data/features/attributes.feature +0 -7
- data/features/batch.feature +0 -10
- data/features/bff_package.feature +0 -12
- data/features/cab_package.feature +0 -21
- data/features/cached.feature +0 -7
- data/features/chef_gem.feature +0 -14
- data/features/chocolatey_package.feature +0 -14
- data/features/compile_time.feature +0 -7
- data/features/cookbook_file.feature +0 -13
- data/features/cron.feature +0 -11
- data/features/custom_matcher.feature +0 -11
- data/features/custom_resource.feature +0 -7
- data/features/deploy.feature +0 -12
- data/features/directory.feature +0 -11
- data/features/dnf_package.feature +0 -26
- data/features/do_nothing.feature +0 -10
- data/features/dpkg_package.feature +0 -12
- data/features/dsc_resource.feature +0 -10
- data/features/dsc_script.feature +0 -10
- data/features/env.feature +0 -12
- data/features/erl_call.feature +0 -10
- data/features/execute.feature +0 -10
- data/features/exotic_zero_port.feature +0 -7
- data/features/expect_exception.feature +0 -12
- data/features/file.feature +0 -13
- data/features/freebsd_package.feature +0 -11
- data/features/gem_package.feature +0 -14
- data/features/git.feature +0 -12
- data/features/group.feature +0 -13
- data/features/guards.feature +0 -10
- data/features/heavy_provider_light_resource.feature +0 -10
- data/features/homebrew_package.feature +0 -12
- data/features/http_request.feature +0 -15
- data/features/ifconfig.feature +0 -13
- data/features/include_recipe.feature +0 -10
- data/features/ips_package.feature +0 -12
- data/features/launchd.feature +0 -17
- data/features/link.feature +0 -12
- data/features/log.feature +0 -10
- data/features/macports_package.feature +0 -13
- data/features/mdadm.feature +0 -12
- data/features/mount.feature +0 -14
- data/features/msu_package.feature +0 -23
- data/features/multiple_actions.feature +0 -12
- data/features/multiple_run_action.feature +0 -7
- data/features/notifications.feature +0 -14
- data/features/ohai.feature +0 -10
- data/features/openbsd_package.feature +0 -12
- data/features/osx_profile.feature +0 -13
- data/features/package.feature +0 -14
- data/features/pacman_package.feature +0 -13
- data/features/paludis_package.feature +0 -12
- data/features/portage_package.feature +0 -13
- data/features/powershell_script.feature +0 -10
- data/features/reboot.feature +0 -12
- data/features/registry_key.feature +0 -13
- data/features/remote_directory.feature +0 -12
- data/features/remote_file.feature +0 -13
- data/features/render_file.feature +0 -11
- data/features/roles.feature +0 -7
- data/features/route.feature +0 -11
- data/features/rpm_package.feature +0 -12
- data/features/ruby_block.feature +0 -11
- data/features/script.feature +0 -16
- data/features/server.feature +0 -16
- data/features/server_on_disk.feature +0 -16
- data/features/service.feature +0 -15
- data/features/smartos_package.feature +0 -12
- data/features/solaris_package.feature +0 -12
- data/features/state_attrs.feature +0 -7
- data/features/step_definitions/background_steps.rb +0 -7
- data/features/step_into.feature +0 -7
- data/features/stub_command.feature +0 -7
- data/features/stub_data_bag.feature +0 -7
- data/features/stub_data_bag_item.feature +0 -7
- data/features/stub_node.feature +0 -7
- data/features/stub_search.feature +0 -7
- data/features/subscribes.feature +0 -14
- data/features/subversion.feature +0 -13
- data/features/support/env.rb +0 -38
- data/features/support/executor.rb +0 -20
- data/features/support/exotic_zero_port.rb +0 -3
- data/features/support/on_disk.rb +0 -7
- data/features/systemd_unit.feature +0 -27
- data/features/template.feature +0 -13
- data/features/use_inline_resources.feature +0 -7
- data/features/user.feature +0 -15
- data/features/windows_package.feature +0 -11
- data/features/windows_service.feature +0 -16
- data/features/yum_package.feature +0 -13
- data/features/yum_repository.feature +0 -23
- data/features/zypper_package.feature +0 -13
- data/lib/chefspec/api/apt_package.rb +0 -192
- data/lib/chefspec/api/apt_repository.rb +0 -56
- data/lib/chefspec/api/apt_update.rb +0 -53
- data/lib/chefspec/api/batch.rb +0 -43
- data/lib/chefspec/api/bff_package.rb +0 -154
- data/lib/chefspec/api/cab_package.rb +0 -80
- data/lib/chefspec/api/chef_gem.rb +0 -191
- data/lib/chefspec/api/chocolatey_package.rb +0 -107
- data/lib/chefspec/api/cookbook_file.rb +0 -166
- data/lib/chefspec/api/cron.rb +0 -80
- data/lib/chefspec/api/deploy.rb +0 -117
- data/lib/chefspec/api/directory.rb +0 -80
- data/lib/chefspec/api/dnf_package.rb +0 -154
- data/lib/chefspec/api/dpkg_package.rb +0 -117
- data/lib/chefspec/api/dsc_resource.rb +0 -49
- data/lib/chefspec/api/dsc_script.rb +0 -37
- data/lib/chefspec/api/easy_install_package.rb +0 -154
- data/lib/chefspec/api/env.rb +0 -117
- data/lib/chefspec/api/erl_call.rb +0 -43
- data/lib/chefspec/api/execute.rb +0 -43
- data/lib/chefspec/api/file.rb +0 -166
- data/lib/chefspec/api/freebsd_package.rb +0 -80
- data/lib/chefspec/api/gem_package.rb +0 -191
- data/lib/chefspec/api/git.rb +0 -117
- data/lib/chefspec/api/group.rb +0 -154
- data/lib/chefspec/api/homebrew_package.rb +0 -154
- data/lib/chefspec/api/http_request.rb +0 -228
- data/lib/chefspec/api/ifconfig.rb +0 -154
- data/lib/chefspec/api/ips_package.rb +0 -117
- data/lib/chefspec/api/launchd.rb +0 -151
- data/lib/chefspec/api/log.rb +0 -43
- data/lib/chefspec/api/macports_package.rb +0 -154
- data/lib/chefspec/api/mdadm.rb +0 -117
- data/lib/chefspec/api/mount.rb +0 -192
- data/lib/chefspec/api/msu_package.rb +0 -81
- data/lib/chefspec/api/ohai.rb +0 -43
- data/lib/chefspec/api/openbsd_package.rb +0 -155
- data/lib/chefspec/api/osx_profile.rb +0 -63
- data/lib/chefspec/api/package.rb +0 -192
- data/lib/chefspec/api/pacman_package.rb +0 -155
- data/lib/chefspec/api/paludis_package.rb +0 -155
- data/lib/chefspec/api/portage_package.rb +0 -155
- data/lib/chefspec/api/powershell_script.rb +0 -43
- data/lib/chefspec/api/registry_key.rb +0 -166
- data/lib/chefspec/api/remote_directory.rb +0 -120
- data/lib/chefspec/api/remote_file.rb +0 -166
- data/lib/chefspec/api/route.rb +0 -80
- data/lib/chefspec/api/rpm_package.rb +0 -117
- data/lib/chefspec/api/ruby_block.rb +0 -68
- data/lib/chefspec/api/script.rb +0 -278
- data/lib/chefspec/api/service.rb +0 -246
- data/lib/chefspec/api/smartos_package.rb +0 -117
- data/lib/chefspec/api/solaris_package.rb +0 -117
- data/lib/chefspec/api/subversion.rb +0 -154
- data/lib/chefspec/api/systemd_unit.rb +0 -353
- data/lib/chefspec/api/template.rb +0 -166
- data/lib/chefspec/api/windows_package.rb +0 -86
- data/lib/chefspec/api/windows_service.rb +0 -286
- data/lib/chefspec/api/yum_package.rb +0 -154
- data/lib/chefspec/api/yum_repository.rb +0 -130
- data/lib/chefspec/api/zypper_package.rb +0 -154
- data/lib/chefspec/macros.rb +0 -222
- data/spec/unit/api_spec.rb +0 -18
data/lib/chefspec/api/link.rb
CHANGED
|
@@ -1,102 +1,28 @@
|
|
|
1
|
-
module ChefSpec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
module ChefSpec
|
|
2
|
+
module API
|
|
3
|
+
module Link
|
|
4
|
+
#
|
|
5
|
+
# Assert that a symlink links to a specific path. This is really
|
|
6
|
+
# syntactic sugar for the following:
|
|
7
|
+
#
|
|
8
|
+
# expect(chef_run).to create_link('/tmp/thing').with(to: '/tmp/other_thing')
|
|
9
|
+
#
|
|
10
|
+
# @example Using +link_to+ with a String path
|
|
11
|
+
# link = chef_run.link('/tmp/thing')
|
|
12
|
+
# expect(link).to link_to('/tmp/other_thing')
|
|
13
|
+
#
|
|
14
|
+
# @example Using +link_to+ with a regular expression
|
|
15
|
+
# expect(link).to link_to(/\/tmp/(.+)/)
|
|
16
|
+
#
|
|
17
|
+
# @param [String, Regex] path
|
|
18
|
+
# the path to link to
|
|
19
|
+
#
|
|
20
|
+
# @return [ChefSpec::Matchers::LinkToMatcher]
|
|
21
|
+
#
|
|
22
|
+
def link_to(path)
|
|
23
|
+
ChefSpec::Matchers::LinkToMatcher.new(path)
|
|
24
|
+
end
|
|
5
25
|
|
|
6
|
-
#
|
|
7
|
-
# Assert that a +link+ resource exists in the Chef run with the
|
|
8
|
-
# action +:create+. Given a Chef Recipe that creates "/tmp" as a
|
|
9
|
-
# +link+:
|
|
10
|
-
#
|
|
11
|
-
# link '/tmp' do
|
|
12
|
-
# action :create
|
|
13
|
-
# end
|
|
14
|
-
#
|
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
|
16
|
-
# +link+ resource with ChefSpec.
|
|
17
|
-
#
|
|
18
|
-
# @example Assert that a +link+ was created
|
|
19
|
-
# expect(chef_run).to create_link('/tmp')
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that a +link+ was created with predicate matchers
|
|
22
|
-
# expect(chef_run).to create_link('/tmp').with_link_type(:hard)
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that a +link+ was created with attributes
|
|
25
|
-
# expect(chef_run).to create_link('/tmp').with(link_type: :hard)
|
|
26
|
-
#
|
|
27
|
-
# @example Assert that a +link+ was created using a regex
|
|
28
|
-
# expect(chef_run).to create_link('/tmp').with(link_type: Symbol)
|
|
29
|
-
#
|
|
30
|
-
# @example Assert that a +link+ was _not_ created
|
|
31
|
-
# expect(chef_run).to_not create_link('/tmp')
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
# @param [String, Regex] resource_name
|
|
35
|
-
# the name of the resource to match
|
|
36
|
-
#
|
|
37
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
38
|
-
#
|
|
39
|
-
def create_link(resource_name)
|
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:link, :create, resource_name)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Assert that a +link+ resource exists in the Chef run with the
|
|
45
|
-
# action +:delete+. Given a Chef Recipe that deletes "/tmp" as a
|
|
46
|
-
# +link+:
|
|
47
|
-
#
|
|
48
|
-
# link '/tmp' do
|
|
49
|
-
# action :delete
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
|
53
|
-
# +link+ resource with ChefSpec.
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that a +link+ was deleted
|
|
56
|
-
# expect(chef_run).to delete_link('/tmp')
|
|
57
|
-
#
|
|
58
|
-
# @example Assert that a +link+ was deleted with predicate matchers
|
|
59
|
-
# expect(chef_run).to delete_link('/tmp').with_link_type(:hard)
|
|
60
|
-
#
|
|
61
|
-
# @example Assert that a +link+ was deleted with attributes
|
|
62
|
-
# expect(chef_run).to delete_link('/tmp').with(link_type: :hard)
|
|
63
|
-
#
|
|
64
|
-
# @example Assert that a +link+ was deleted using a regex
|
|
65
|
-
# expect(chef_run).to delete_link('/tmp').with(link_type: Symbol)
|
|
66
|
-
#
|
|
67
|
-
# @example Assert that a +link+ was _not_ deleted
|
|
68
|
-
# expect(chef_run).to_not delete_link('/tmp')
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
# @param [String, Regex] resource_name
|
|
72
|
-
# the name of the resource to match
|
|
73
|
-
#
|
|
74
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
75
|
-
#
|
|
76
|
-
def delete_link(resource_name)
|
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:link, :delete, resource_name)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
# Assert that a symlink links to a specific path. This is really
|
|
82
|
-
# syntactic sugar for the following:
|
|
83
|
-
#
|
|
84
|
-
# expect(chef_run).to create_link('/tmp/thing').with(to: '/tmp/other_thing')
|
|
85
|
-
#
|
|
86
|
-
# @example Using +link_to+ with a String path
|
|
87
|
-
# link = chef_run.link('/tmp/thing')
|
|
88
|
-
# expect(link).to link_to('/tmp/other_thing')
|
|
89
|
-
#
|
|
90
|
-
# @example Using +link_to+ with a regular expression
|
|
91
|
-
# expect(link).to link_to(/\/tmp/(.+)/)
|
|
92
|
-
#
|
|
93
|
-
# @param [String, Regex] path
|
|
94
|
-
# the path to link to
|
|
95
|
-
#
|
|
96
|
-
# @return [ChefSpec::Matchers::LinkToMatcher]
|
|
97
|
-
#
|
|
98
|
-
def link_to(path)
|
|
99
|
-
ChefSpec::Matchers::LinkToMatcher.new(path)
|
|
100
26
|
end
|
|
101
27
|
end
|
|
102
28
|
end
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
module ChefSpec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
module ChefSpec
|
|
2
|
+
module API
|
|
3
|
+
module Notifications
|
|
4
|
+
#
|
|
5
|
+
# Assert that a resource notifies another. Given a Chef Recipe that
|
|
6
|
+
# notifies a template resource to restart apache:
|
|
7
|
+
#
|
|
8
|
+
# template '/etc/apache2/config' do
|
|
9
|
+
# notifies :restart, 'service[apache2]'
|
|
10
|
+
# end
|
|
11
|
+
#
|
|
12
|
+
# The Examples section demonstrates the different ways to test an
|
|
13
|
+
# notifications on a resource with ChefSpec.
|
|
14
|
+
#
|
|
15
|
+
# @example Assert the template notifies apache of something
|
|
16
|
+
# template = chef_run.template('/etc/apache2.conf')
|
|
17
|
+
# expect(template).to notify('service[apache2]')
|
|
18
|
+
#
|
|
19
|
+
# @example Assert the template notifies apache to restart
|
|
20
|
+
# expect(template).to notify('service[apache2]').to(:restart)
|
|
21
|
+
#
|
|
22
|
+
# @example Assert the template notifies apache to restart immediately
|
|
23
|
+
# expect(template).to notify('service[apache2]').to(:restart).immediately
|
|
24
|
+
#
|
|
25
|
+
# @example Assert the template notifies apache to restart delayed
|
|
26
|
+
# expect(template).to notify('service[apache2]').to(:restart).delayed
|
|
27
|
+
#
|
|
28
|
+
#
|
|
29
|
+
# @param [String] signature
|
|
30
|
+
# the signature of the notification to match
|
|
31
|
+
#
|
|
32
|
+
# @return [ChefSpec::Matchers::NotificationsMatcher]
|
|
33
|
+
#
|
|
34
|
+
def notify(signature)
|
|
35
|
+
ChefSpec::Matchers::NotificationsMatcher.new(signature)
|
|
36
|
+
end
|
|
37
|
+
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
end
|
data/lib/chefspec/api/reboot.rb
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
module ChefSpec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
module ChefSpec
|
|
2
|
+
module API
|
|
3
|
+
module Reboot
|
|
4
|
+
def now_reboot(resource_name)
|
|
5
|
+
ChefSpec::Matchers::ResourceMatcher.new(:reboot, :reboot_now, resource_name)
|
|
6
|
+
end
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def request_reboot(resource_name)
|
|
11
|
-
ChefSpec::Matchers::ResourceMatcher.new(:reboot, :request_reboot, resource_name)
|
|
12
|
-
end
|
|
8
|
+
def request_reboot(resource_name)
|
|
9
|
+
ChefSpec::Matchers::ResourceMatcher.new(:reboot, :request_reboot, resource_name)
|
|
10
|
+
end
|
|
13
11
|
|
|
14
|
-
def cancel_reboot(resource_name)
|
|
15
|
-
ChefSpec::Matchers::ResourceMatcher.new(:reboot, :cancel, resource_name)
|
|
16
12
|
end
|
|
17
13
|
end
|
|
18
14
|
end
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
module ChefSpec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
module ChefSpec
|
|
2
|
+
module API
|
|
3
|
+
module RenderFile
|
|
4
|
+
#
|
|
5
|
+
# Assert that a file is rendered by the Chef run. This matcher works for
|
|
6
|
+
# +template+, +file+, and +cookbook_file+ resources. The content from the
|
|
7
|
+
# resource must be convertable to a string; verifying the content of a
|
|
8
|
+
# binary file is not permissible at this time.
|
|
9
|
+
#
|
|
10
|
+
# @example Assert a template is rendered
|
|
11
|
+
# expect(chef_run).to render_file('/etc/foo')
|
|
12
|
+
#
|
|
13
|
+
# @example Assert a template is rendered with certain content
|
|
14
|
+
# expect(template).to render_file('/etc/foo').with_content('This is a file')
|
|
15
|
+
#
|
|
16
|
+
# @example Assert a template is rendered with matching content
|
|
17
|
+
# expect(template).to render_file('/etc/foo').with_content(/^This(.+)$/)
|
|
18
|
+
#
|
|
19
|
+
# @example Assert a template is rendered with content matching any RSpec matcher
|
|
20
|
+
# expect(template).to render_file('/etc/foo').with_content(starts_with('This'))
|
|
21
|
+
#
|
|
22
|
+
# @example Assert a partial path to a template is rendered with matching content
|
|
23
|
+
# expect(template).to render_file(/\/etc\/foo-(\d+)$/).with_content(/^This(.+)$/)
|
|
24
|
+
#
|
|
25
|
+
#
|
|
26
|
+
# @param [String] path
|
|
27
|
+
# the path of the file to render
|
|
28
|
+
#
|
|
29
|
+
# @return [ChefSpec::Matchers::RenderFileMatcher]
|
|
30
|
+
#
|
|
31
|
+
def render_file(path)
|
|
32
|
+
ChefSpec::Matchers::RenderFileMatcher.new(path)
|
|
33
|
+
end
|
|
34
|
+
|
|
33
35
|
end
|
|
34
36
|
end
|
|
35
37
|
end
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
module ChefSpec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
module ChefSpec
|
|
2
|
+
module API
|
|
3
|
+
module StateAttrs
|
|
4
|
+
#
|
|
5
|
+
# Assert that a Chef resource has certain state attributes (since Chef
|
|
6
|
+
# 11.8.0):
|
|
7
|
+
#
|
|
8
|
+
# state_attrs :time, :temperature
|
|
9
|
+
#
|
|
10
|
+
# @see https://github.com/opscode/chef/blob/e43d7ebda/lib/chef/resource/file.rb#L32-L37
|
|
11
|
+
#
|
|
12
|
+
# The Examples section demonstrates the different ways to test a
|
|
13
|
+
# resource's +state_attrs+ with ChefSpec.
|
|
14
|
+
#
|
|
15
|
+
# @example Assert the +lwrp+ resource has two state attributes
|
|
16
|
+
# expect(lwrp).to have_state_attrs(:time, :temperature)
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
# @param [Array] state_attrs
|
|
20
|
+
# the list of state attributes to assert
|
|
21
|
+
#
|
|
22
|
+
# @return [ChefSpec::Matchers::StateAttrsMatcher]
|
|
23
|
+
#
|
|
24
|
+
def have_state_attrs(*state_attrs)
|
|
25
|
+
ChefSpec::Matchers::StateAttrsMatcher.new(state_attrs)
|
|
26
|
+
end
|
|
27
|
+
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
end
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
module ChefSpec
|
|
2
|
+
module API
|
|
3
|
+
module Stubs
|
|
4
|
+
#
|
|
5
|
+
# Stub a shell command to return a particular value without
|
|
6
|
+
# shelling out to the system.
|
|
7
|
+
#
|
|
8
|
+
# @example stubbing a command to return true
|
|
9
|
+
# stub_command('test -f /tmp/bacon').and_return(true)
|
|
10
|
+
#
|
|
11
|
+
# @example stubbing a block that is evaluated at runtime
|
|
12
|
+
# stub_command('test -f /tmp/bacon') { MyClass.check? }
|
|
13
|
+
#
|
|
14
|
+
# @example stubbing a command that matches a pattern
|
|
15
|
+
# stub_command(/test \-f/).and_return(true)
|
|
16
|
+
#
|
|
17
|
+
# @example stubbing a command that raises an exception
|
|
18
|
+
# stub_command('test -f /tmp/bacon').and_raise(SomeException)
|
|
19
|
+
#
|
|
20
|
+
#
|
|
21
|
+
# @param [String, Regexp] command
|
|
22
|
+
# the command to stub
|
|
23
|
+
#
|
|
24
|
+
# @return [ChefSpec::CommandStub]
|
|
25
|
+
#
|
|
26
|
+
def stub_command(command, &block)
|
|
27
|
+
ChefSpec::Stubs::CommandRegistry.register(ChefSpec::Stubs::CommandStub.new(command, &block))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#
|
|
31
|
+
# Stub a Chef call to load a data_bag.
|
|
32
|
+
#
|
|
33
|
+
# @example stubbing a data_bag to return an empty Array
|
|
34
|
+
# stub_data_bag('users').and_return([])
|
|
35
|
+
#
|
|
36
|
+
# @example stubbing a data_bag with a block that is evaluated at runtime
|
|
37
|
+
# stub_data_bag('users') { JSON.parse(File.read('fixtures/data_bag.json')) }
|
|
38
|
+
#
|
|
39
|
+
# @example stubbing a data_bag to return an Array of Hashes
|
|
40
|
+
# stub_data_bag('users').and_return([
|
|
41
|
+
# { id: 'bacon', comment: 'delicious' },
|
|
42
|
+
# { id: 'ham', comment: 'also good' }
|
|
43
|
+
# ])
|
|
44
|
+
#
|
|
45
|
+
# @example stubbing a data_bag to raise an exception
|
|
46
|
+
# stub_data_bag('users').and_raise(Chef::Exceptions::PrivateKeyMissing)
|
|
47
|
+
#
|
|
48
|
+
#
|
|
49
|
+
# @param [String, Symbol] bag
|
|
50
|
+
# the name of the data bag to stub
|
|
51
|
+
#
|
|
52
|
+
# @return [ChefSpec::DataBagStub]
|
|
53
|
+
#
|
|
54
|
+
def stub_data_bag(bag, &block)
|
|
55
|
+
ChefSpec::Stubs::DataBagRegistry.register(ChefSpec::Stubs::DataBagStub.new(bag, &block))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Stub a Chef data_bag call.
|
|
60
|
+
#
|
|
61
|
+
# @example stubbing a data_bag_item to return a Hash of data
|
|
62
|
+
# stub_data_bag_item('users', 'svargo').and_return({
|
|
63
|
+
# id: 'svargo',
|
|
64
|
+
# name: 'Seth Vargo'
|
|
65
|
+
# })
|
|
66
|
+
#
|
|
67
|
+
# @example stubbing a data_bag_item with a block that is evaluated at runtime
|
|
68
|
+
# stub_data_bag_item('users', 'svargo') { JSON.parse(File.read('fixtures/data_bag_item.json')) }
|
|
69
|
+
#
|
|
70
|
+
# @example stubbing a data_bag_item to raise an exception
|
|
71
|
+
# stub_data_bag('users', 'svargo').and_raise(Chef::Exceptions::PrivateKeyMissing)
|
|
72
|
+
#
|
|
73
|
+
#
|
|
74
|
+
# @param [String, Symbol] bag
|
|
75
|
+
# the name of the data bag to find the item in
|
|
76
|
+
# @param [String] id
|
|
77
|
+
# the id of the data bag item to stub
|
|
78
|
+
#
|
|
79
|
+
# @return [ChefSpec::DataBagItemStub]
|
|
80
|
+
#
|
|
81
|
+
def stub_data_bag_item(bag, id, &block)
|
|
82
|
+
ChefSpec::Stubs::DataBagItemRegistry.register(ChefSpec::Stubs::DataBagItemStub.new(bag, id, &block))
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
#
|
|
86
|
+
# Creates a fake Chef::Node for use in testing.
|
|
87
|
+
#
|
|
88
|
+
# @example mocking a simple node
|
|
89
|
+
# stub_node('mynode.example')
|
|
90
|
+
#
|
|
91
|
+
# @example mocking a specific platform and version
|
|
92
|
+
# stub_node('mynode.example', platform: 'ubuntu', version: '18.04')
|
|
93
|
+
#
|
|
94
|
+
# @example overriding a specific ohai attribute
|
|
95
|
+
# stub_node('mynode.example', ohai: { ipaddress: '1.2.3.4' })
|
|
96
|
+
#
|
|
97
|
+
# @example stubbing a node based on a JSON fixture
|
|
98
|
+
# stub_node('mynode.example', path: File.join('fixtures', 'nodes', 'default.json'))
|
|
99
|
+
#
|
|
100
|
+
# @example setting specific attributes
|
|
101
|
+
# stub_node('mynode.example') do |node|
|
|
102
|
+
# node.default['attribute']['thing'] = 'value'
|
|
103
|
+
# end
|
|
104
|
+
#
|
|
105
|
+
#
|
|
106
|
+
# @param [String] name
|
|
107
|
+
# the name of the node
|
|
108
|
+
# @param [Hash] options
|
|
109
|
+
# the list of options for the node
|
|
110
|
+
#
|
|
111
|
+
# @option options [Symbol] :platform
|
|
112
|
+
# the platform to mock
|
|
113
|
+
# @option options [Symbol] :version
|
|
114
|
+
# the version of the platform to mock
|
|
115
|
+
# @option options [Symbol] :path
|
|
116
|
+
# filepath to a JSON file to pull a node from
|
|
117
|
+
# @option options [Hash] :ohai
|
|
118
|
+
# a Hash of Ohai attributes to mock on the node
|
|
119
|
+
#
|
|
120
|
+
# @return [Chef::Node]
|
|
121
|
+
#
|
|
122
|
+
def stub_node(*args, &block)
|
|
123
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
|
124
|
+
name = args.first || "node.example"
|
|
125
|
+
|
|
126
|
+
fauxhai = Fauxhai.mock(options).data
|
|
127
|
+
fauxhai = fauxhai.merge(options[:ohai] || {})
|
|
128
|
+
fauxhai = Mash.new(fauxhai)
|
|
129
|
+
|
|
130
|
+
node = Chef::Node.new
|
|
131
|
+
node.name(name)
|
|
132
|
+
node.automatic_attrs = fauxhai
|
|
133
|
+
node.instance_eval(&block) if block_given?
|
|
134
|
+
node
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
#
|
|
138
|
+
# Stub a Chef search to return pre-defined data. When providing a value,
|
|
139
|
+
# the value is automatically mashified (to the best of ChefSpec's abilities)
|
|
140
|
+
# to ease in use.
|
|
141
|
+
#
|
|
142
|
+
# @example stubbing a search to return nothing
|
|
143
|
+
# stub_search(:node)
|
|
144
|
+
#
|
|
145
|
+
# @example stubbing a search with a query
|
|
146
|
+
# stub_search(:node, 'name:*')
|
|
147
|
+
#
|
|
148
|
+
# @example stubbing a search with a query as a regex
|
|
149
|
+
# stub_search(:node, /name:(.+)/)
|
|
150
|
+
#
|
|
151
|
+
# @example stubbing a search with a block that is evaluated at runtime
|
|
152
|
+
# stub_search(:node) { JSON.parse(File.read('fixtures/nodes.json')) }
|
|
153
|
+
#
|
|
154
|
+
# @example stubbing a search to return a fixed value
|
|
155
|
+
# stub_search(:node).and_return([ { a: 'b' } ])
|
|
156
|
+
#
|
|
157
|
+
# @example stubbing a search to raise an exception
|
|
158
|
+
# stub_search(:node).and_raise(Chef::Exceptions::PrivateKeyMissing)
|
|
159
|
+
#
|
|
160
|
+
#
|
|
161
|
+
# @param [String, Symbol] type
|
|
162
|
+
# the type to search to stub
|
|
163
|
+
# @param [String, Symbol, nil] query
|
|
164
|
+
# the query to stub
|
|
165
|
+
#
|
|
166
|
+
# @return [ChefSpec::SearchStub]
|
|
167
|
+
#
|
|
168
|
+
def stub_search(type, query = "*:*", &block)
|
|
169
|
+
ChefSpec::Stubs::SearchRegistry.register(ChefSpec::Stubs::SearchStub.new(type, query, &block))
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Automatically clear all stubs after each test.
|
|
173
|
+
extend RSpec::SharedContext
|
|
174
|
+
after(:each) do
|
|
175
|
+
ChefSpec::Stubs::CommandRegistry.reset!
|
|
176
|
+
ChefSpec::Stubs::DataBagRegistry.reset!
|
|
177
|
+
ChefSpec::Stubs::DataBagItemRegistry.reset!
|
|
178
|
+
ChefSpec::Stubs::SearchRegistry.reset!
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
require "chef/version"
|
|
2
|
+
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
|
|
3
|
+
|
|
4
|
+
module ChefSpec
|
|
5
|
+
module API
|
|
6
|
+
module StubsFor
|
|
7
|
+
# Pull in the needed machinery to use `before` here.
|
|
8
|
+
extend RSpec::SharedContext
|
|
9
|
+
|
|
10
|
+
# Which version to use the shell_out_compacted hook on.
|
|
11
|
+
HAS_SHELLOUT_COMPACTED = Gem::Requirement.create("> 14.2")
|
|
12
|
+
|
|
13
|
+
# Hook used in the monkey patches to set up a place to inject stubs when
|
|
14
|
+
# needed for a resource or provider.
|
|
15
|
+
#
|
|
16
|
+
# @api private
|
|
17
|
+
# @param object [Chef::Resource, Chef::Provider] Resource or provider to inject
|
|
18
|
+
# @param type [Symbol] Type of object to register stubs on
|
|
19
|
+
# @return [void]
|
|
20
|
+
def self.setup_stubs_for(object, type)
|
|
21
|
+
# This space left intentionally blank, real implementation is below.
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Place to hold any stubs which should be active for this example.
|
|
25
|
+
let(:_chefspec_stubs_for_registry) do
|
|
26
|
+
# Auto-vivify for things like _chefspec_stubs_for_registry[:resource]['my_resource'] == [].
|
|
27
|
+
Hash.new do |hash, key|
|
|
28
|
+
hash[key] = Hash.new do |inner_hash, inner_key|
|
|
29
|
+
inner_hash[inner_key] = []
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Take over from the default, no-op implementation of {.setup_stubs_for}.
|
|
35
|
+
before do
|
|
36
|
+
allow(StubsFor).to receive(:setup_stubs_for) do |object, type|
|
|
37
|
+
type_stubs = _chefspec_stubs_for_registry[type]
|
|
38
|
+
resource_object = object.respond_to?(:new_resource) ? object.new_resource : object
|
|
39
|
+
stubs = type_stubs[nil] + type_stubs[resource_object.resource_name.to_s] + type_stubs[resource_object.to_s]
|
|
40
|
+
stubs.each do |stub|
|
|
41
|
+
instance_exec(object, &stub)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Register stubs for resource objects.
|
|
47
|
+
#
|
|
48
|
+
# The `target` parameter can select either a resource string like `'package[foo]'`,
|
|
49
|
+
# a resource name like `'package'`, or `nil` for all resources.
|
|
50
|
+
#
|
|
51
|
+
# @example Setting method stub on a single resource
|
|
52
|
+
# it "does a thing" do
|
|
53
|
+
# stubs_for_resource("my_resource[foo]") do |res|
|
|
54
|
+
# expect(res).to receive_shell_out.with("my_command").and_return(stdout: "asdf")
|
|
55
|
+
# end
|
|
56
|
+
# expect(subject.some_method).to eq "asdf"
|
|
57
|
+
# end
|
|
58
|
+
# @param target [String, nil] Resource name to inject, or nil for all resources.
|
|
59
|
+
# @param current_value [Boolean] If true, also register stubs for current_value objects on the same target.
|
|
60
|
+
# @param block [Proc] A block taking the resource object as a parameter.
|
|
61
|
+
# @return [void]
|
|
62
|
+
def stubs_for_resource(target = nil, current_value: true, current_resource: true, &block)
|
|
63
|
+
current_value = false unless current_resource
|
|
64
|
+
_chefspec_stubs_for_registry[:resource][target] << block
|
|
65
|
+
stubs_for_current_value(target, &block) if current_value
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Register stubs for current_value objects.
|
|
69
|
+
#
|
|
70
|
+
# @see #stubs_for_resource
|
|
71
|
+
# @param target [String, nil] Resource name to inject, or nil for all resources.
|
|
72
|
+
# @param block [Proc] A block taking the resource object as a parameter.
|
|
73
|
+
# @return [void]
|
|
74
|
+
def stubs_for_current_value(target = nil, &block)
|
|
75
|
+
_chefspec_stubs_for_registry[:current_value][target] << block
|
|
76
|
+
end
|
|
77
|
+
alias_method :stubs_for_current_resource, :stubs_for_current_value
|
|
78
|
+
|
|
79
|
+
# Register stubs for provider objects.
|
|
80
|
+
#
|
|
81
|
+
# @see #stubs_for_resource
|
|
82
|
+
# @param target [String, nil] Resource name to inject, or nil for all providers.
|
|
83
|
+
# @param block [Proc] A block taking the resource object as a parameter.
|
|
84
|
+
# @return [void]
|
|
85
|
+
def stubs_for_provider(target = nil, &block)
|
|
86
|
+
_chefspec_stubs_for_registry[:provider][target] << block
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def receive_shell_out(*cmd, stdout: "", stderr: "", exitstatus: 0, **opts)
|
|
90
|
+
# Ruby does not allow constructing an actual exitstatus object from Ruby code. Really.
|
|
91
|
+
fake_exitstatus = double(exitstatus: exitstatus)
|
|
92
|
+
fake_cmd = Mixlib::ShellOut.new(*cmd)
|
|
93
|
+
fake_cmd.define_singleton_method(:run_command) {} # Do nothing, just in case.
|
|
94
|
+
# Inject our canned data.
|
|
95
|
+
fake_cmd.instance_exec do
|
|
96
|
+
@stdout = stdout
|
|
97
|
+
@stderr = stderr
|
|
98
|
+
@status = fake_exitstatus
|
|
99
|
+
end
|
|
100
|
+
# On newer Chef, we can intercept using the new, better shell_out_compact hook point.
|
|
101
|
+
shell_out_method ||= if HAS_SHELLOUT_COMPACTED.satisfied_by?(Gem::Version.create(Chef::VERSION))
|
|
102
|
+
:shell_out_compacted
|
|
103
|
+
else
|
|
104
|
+
:shell_out
|
|
105
|
+
end
|
|
106
|
+
with_args = cmd + (opts.empty? ? [any_args] : [hash_including(opts)])
|
|
107
|
+
receive(shell_out_method).with(*with_args).and_return(fake_cmd)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
module ClassMethods
|
|
111
|
+
# (see StubsFor#stubs_for_resource)
|
|
112
|
+
def stubs_for_resource(*args, **kwargs, &block)
|
|
113
|
+
before { stubs_for_resource(*args, **kwargs, &block) }
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# (see StubsFor#stubs_for_current_value)
|
|
117
|
+
def stubs_for_current_value(*args, &block)
|
|
118
|
+
before { stubs_for_current_value(*args, &block) }
|
|
119
|
+
end
|
|
120
|
+
alias_method :stubs_for_current_resource, :stubs_for_current_value
|
|
121
|
+
|
|
122
|
+
# (see StubsFor#stubs_for_provider)
|
|
123
|
+
def stubs_for_provider(*args, &block)
|
|
124
|
+
before { stubs_for_provider(*args, &block) }
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# @api private
|
|
128
|
+
def included(klass)
|
|
129
|
+
super
|
|
130
|
+
# Inject classmethods into the group.
|
|
131
|
+
klass.extend(ClassMethods)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
extend ClassMethods
|
|
136
|
+
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|