chefspec 7.2.1 → 7.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +21 -13
- data/CHANGELOG.md +4 -0
- data/Gemfile +14 -10
- data/README.md +322 -1025
- data/README_old.md +1291 -0
- data/Rakefile +8 -3
- data/examples/apt_package/spec/install_spec.rb +1 -1
- data/examples/apt_package/spec/lock_spec.rb +1 -1
- data/examples/apt_package/spec/purge_spec.rb +1 -1
- data/examples/apt_package/spec/reconfig_spec.rb +1 -1
- data/examples/apt_package/spec/remove_spec.rb +1 -1
- data/examples/apt_package/spec/unlock_spec.rb +1 -1
- data/examples/apt_package/spec/upgrade_spec.rb +1 -1
- data/examples/apt_repository/spec/add_spec.rb +1 -1
- data/examples/apt_repository/spec/remove_spec.rb +1 -1
- data/examples/apt_update/spec/periodic_spec.rb +1 -1
- data/examples/apt_update/spec/update_spec.rb +1 -1
- data/examples/attributes/spec/default_spec.rb +1 -1
- data/examples/batch/spec/run_spec.rb +1 -1
- data/examples/cab_package/spec/install_spec.rb +1 -1
- data/examples/cab_package/spec/remove_spec.rb +1 -1
- data/examples/cached/spec/default_spec.rb +1 -1
- data/examples/chef_gem/spec/install_spec.rb +1 -1
- data/examples/chef_gem/spec/purge_spec.rb +1 -1
- data/examples/chef_gem/spec/reconfig_spec.rb +1 -1
- data/examples/chef_gem/spec/remove_spec.rb +1 -1
- data/examples/chef_gem/spec/upgrade_spec.rb +1 -1
- data/examples/chocolatey_package/spec/install_spec.rb +1 -1
- data/examples/chocolatey_package/spec/remove_spec.rb +1 -1
- data/examples/chocolatey_package/spec/upgrade_spec.rb +1 -1
- data/examples/compile_time/spec/default_spec.rb +1 -1
- data/examples/cookbook_file/spec/create_if_missing_spec.rb +1 -1
- data/examples/cookbook_file/spec/create_spec.rb +1 -1
- data/examples/cookbook_file/spec/delete_spec.rb +1 -1
- data/examples/cookbook_file/spec/touch_spec.rb +1 -1
- data/examples/core/recipes/default.rb +1 -0
- data/examples/core/spec/default_spec.rb +7 -0
- data/examples/core/spec/non_recipe_spec.rb +5 -0
- data/examples/cron/spec/create_spec.rb +1 -1
- data/examples/cron/spec/delete_spec.rb +1 -1
- data/examples/custom_matcher/spec/install_spec.rb +1 -1
- data/examples/custom_matcher/spec/remove_spec.rb +1 -1
- data/examples/custom_resource/spec/default_spec.rb +1 -1
- data/examples/custom_resource_block/resources/default.rb +3 -0
- data/examples/custom_resource_block/spec/default_spec.rb +10 -0
- data/examples/directory/spec/create_spec.rb +1 -1
- data/examples/directory/spec/delete_spec.rb +1 -1
- data/examples/dnf_package/spec/install_spec.rb +1 -1
- data/examples/dnf_package/spec/purge_spec.rb +1 -1
- data/examples/dnf_package/spec/remove_spec.rb +1 -1
- data/examples/dnf_package/spec/upgrade_spec.rb +1 -1
- data/examples/do_nothing/spec/default_spec.rb +1 -1
- data/examples/dpkg_package/spec/install_spec.rb +1 -1
- data/examples/dpkg_package/spec/purge_spec.rb +1 -1
- data/examples/dpkg_package/spec/remove_spec.rb +1 -1
- data/examples/dsc_resource/spec/run_spec.rb +1 -1
- data/examples/dsc_script/spec/run_spec.rb +1 -1
- data/examples/env/spec/create_spec.rb +1 -1
- data/examples/env/spec/delete_spec.rb +1 -1
- data/examples/env/spec/modify_spec.rb +1 -1
- data/examples/execute/spec/run_spec.rb +1 -1
- data/examples/expect_exception/spec/compile_error_spec.rb +1 -1
- data/examples/expect_exception/spec/converge_error_spec.rb +1 -1
- data/examples/expect_exception/spec/no_error_spec.rb +1 -1
- data/examples/file/spec/create_if_missing_spec.rb +1 -1
- data/examples/file/spec/create_spec.rb +1 -1
- data/examples/file/spec/delete_spec.rb +1 -1
- data/examples/file/spec/touch_spec.rb +1 -1
- data/examples/freebsd_package/spec/install_spec.rb +1 -1
- data/examples/freebsd_package/spec/remove_spec.rb +1 -1
- data/examples/gem_package/spec/install_spec.rb +1 -1
- data/examples/gem_package/spec/purge_spec.rb +1 -1
- data/examples/gem_package/spec/reconfig_spec.rb +1 -1
- data/examples/gem_package/spec/remove_spec.rb +1 -1
- data/examples/gem_package/spec/upgrade_spec.rb +1 -1
- data/examples/git/spec/checkout_spec.rb +1 -1
- data/examples/git/spec/export_spec.rb +1 -1
- data/examples/git/spec/sync_spec.rb +1 -1
- data/examples/group/spec/create_spec.rb +1 -1
- data/examples/group/spec/manage_spec.rb +1 -1
- data/examples/group/spec/modify_spec.rb +1 -1
- data/examples/group/spec/remove_spec.rb +1 -1
- data/examples/guards/spec/default_spec.rb +1 -1
- data/examples/heavy_provider_light_resource/spec/provider_service_spec.rb +1 -1
- data/examples/homebrew_package/spec/install_spec.rb +1 -1
- data/examples/homebrew_package/spec/purge_spec.rb +1 -1
- data/examples/homebrew_package/spec/remove_spec.rb +1 -1
- data/examples/homebrew_package/spec/upgrade_spec.rb +1 -1
- data/examples/http_request/spec/delete_spec.rb +1 -1
- data/examples/http_request/spec/get_spec.rb +1 -1
- data/examples/http_request/spec/head_spec.rb +1 -1
- data/examples/http_request/spec/options_spec.rb +1 -1
- data/examples/http_request/spec/post_spec.rb +1 -1
- data/examples/http_request/spec/put_spec.rb +1 -1
- data/examples/ifconfig/spec/add_spec.rb +1 -1
- data/examples/ifconfig/spec/delete_spec.rb +1 -1
- data/examples/ifconfig/spec/disable_spec.rb +1 -1
- data/examples/ifconfig/spec/enable_spec.rb +1 -1
- data/examples/include_recipe/spec/default_spec.rb +1 -1
- data/examples/ips_package/spec/install_spec.rb +1 -1
- data/examples/ips_package/spec/remove_spec.rb +1 -1
- data/examples/ips_package/spec/upgrade_spec.rb +1 -1
- data/examples/launchd/spec/create_if_missing_spec.rb +1 -1
- data/examples/launchd/spec/create_spec.rb +1 -1
- data/examples/launchd/spec/delete_spec.rb +1 -1
- data/examples/launchd/spec/disable_spec.rb +1 -1
- data/examples/launchd/spec/enable_spec.rb +1 -1
- data/examples/library_patch/libraries/default.rb +5 -0
- data/examples/library_patch/recipes/default.rb +1 -0
- data/examples/library_patch/spec/default_spec.rb +14 -0
- data/examples/link/spec/create_spec.rb +1 -1
- data/examples/link/spec/delete_spec.rb +1 -1
- data/examples/link/spec/link_to_spec.rb +1 -1
- data/examples/log/spec/write_spec.rb +1 -1
- data/examples/macports_package/spec/install_spec.rb +1 -1
- data/examples/macports_package/spec/purge_spec.rb +1 -1
- data/examples/macports_package/spec/remove_spec.rb +1 -1
- data/examples/macports_package/spec/upgrade_spec.rb +1 -1
- data/examples/mdadm/spec/assemble_spec.rb +1 -1
- data/examples/mdadm/spec/create_spec.rb +1 -1
- data/examples/mdadm/spec/stop_spec.rb +1 -1
- data/examples/mount/spec/disable_spec.rb +1 -1
- data/examples/mount/spec/enable_spec.rb +1 -1
- data/examples/mount/spec/mount_spec.rb +1 -1
- data/examples/mount/spec/remount_spec.rb +1 -1
- data/examples/mount/spec/umount_spec.rb +1 -1
- data/examples/msu_package/spec/install_spec.rb +1 -1
- data/examples/msu_package/spec/remove_spec.rb +1 -1
- data/examples/multiple_actions/spec/default_spec.rb +1 -1
- data/examples/multiple_actions/spec/reversed_spec.rb +1 -1
- data/examples/multiple_actions/spec/sequential_spec.rb +1 -1
- data/examples/multiple_run_action/spec/default_spec.rb +1 -1
- data/examples/nothing_matcher/spec/default_spec.rb +1 -1
- data/examples/notifications/spec/before_spec.rb +1 -1
- data/examples/notifications/spec/chained_spec.rb +1 -1
- data/examples/notifications/spec/default_spec.rb +1 -1
- data/examples/notifications/spec/delayed_spec.rb +1 -1
- data/examples/notifications/spec/immediately_spec.rb +1 -1
- data/examples/ohai/spec/reload_spec.rb +1 -1
- data/examples/osx_profile/spec/install_spec.rb +1 -1
- data/examples/osx_profile/spec/remove_spec.rb +1 -1
- data/examples/package/spec/install_spec.rb +1 -1
- data/examples/package/spec/lock_spec.rb +1 -1
- data/examples/package/spec/purge_spec.rb +1 -1
- data/examples/package/spec/reconfig_spec.rb +1 -1
- data/examples/package/spec/remove_spec.rb +1 -1
- data/examples/package/spec/unlock_spec.rb +1 -1
- data/examples/package/spec/upgrade_spec.rb +1 -1
- data/examples/pacman_package/spec/install_spec.rb +1 -1
- data/examples/pacman_package/spec/purge_spec.rb +1 -1
- data/examples/pacman_package/spec/remove_spec.rb +1 -1
- data/examples/pacman_package/spec/upgrade_spec.rb +1 -1
- data/examples/paludis_package/spec/install_spec.rb +1 -1
- data/examples/paludis_package/spec/purge_spec.rb +1 -1
- data/examples/paludis_package/spec/remove_spec.rb +1 -1
- data/examples/paludis_package/spec/upgrade_spec.rb +1 -1
- data/examples/portage_package/spec/install_spec.rb +1 -1
- data/examples/portage_package/spec/purge_spec.rb +1 -1
- data/examples/portage_package/spec/remove_spec.rb +1 -1
- data/examples/portage_package/spec/upgrade_spec.rb +1 -1
- data/examples/powershell_script/spec/run_spec.rb +1 -1
- data/examples/reboot/spec/cancel_spec.rb +1 -1
- data/examples/reboot/spec/now_spec.rb +1 -1
- data/examples/reboot/spec/request_spec.rb +1 -1
- data/examples/recipe_block/metadata.rb +1 -0
- data/examples/recipe_block/spec/recipe_block_spec.rb +34 -0
- data/examples/recipe_block/templates/apache2.conf.erb +1 -0
- data/examples/registry_key/spec/create_if_missing_spec.rb +1 -1
- data/examples/registry_key/spec/create_spec.rb +1 -1
- data/examples/registry_key/spec/delete_key_spec.rb +1 -1
- data/examples/registry_key/spec/delete_spec.rb +1 -1
- data/examples/remote_directory/spec/create_if_missing_spec.rb +1 -1
- data/examples/remote_directory/spec/create_spec.rb +1 -1
- data/examples/remote_directory/spec/delete_spec.rb +1 -1
- data/examples/remote_file/spec/create_if_missing_spec.rb +1 -1
- data/examples/remote_file/spec/create_spec.rb +1 -1
- data/examples/remote_file/spec/delete_spec.rb +1 -1
- data/examples/remote_file/spec/touch_spec.rb +1 -1
- data/examples/render_file/spec/default_spec.rb +12 -1
- data/examples/render_file/spec/template_helpers_spec.rb +1 -1
- data/examples/roles/spec/default_spec.rb +1 -1
- data/examples/route/spec/add_spec.rb +1 -1
- data/examples/route/spec/delete_spec.rb +1 -1
- data/examples/rpm_package/spec/install_spec.rb +1 -1
- data/examples/rpm_package/spec/remove_spec.rb +1 -1
- data/examples/rpm_package/spec/upgrade_spec.rb +1 -1
- data/examples/ruby_block/spec/create_spec.rb +1 -1
- data/examples/ruby_block/spec/run_spec.rb +1 -1
- data/examples/runner/recipes/default.rb +1 -0
- data/examples/runner/spec/default_spec.rb +11 -0
- data/examples/script/spec/run_bash_spec.rb +1 -1
- data/examples/script/spec/run_csh_spec.rb +1 -1
- data/examples/script/spec/run_ksh_spec.rb +1 -1
- data/examples/script/spec/run_perl_spec.rb +1 -1
- data/examples/script/spec/run_python_spec.rb +1 -1
- data/examples/script/spec/run_ruby_spec.rb +1 -1
- data/examples/script/spec/run_script_spec.rb +1 -1
- data/examples/server/spec/client_spec.rb +1 -1
- data/examples/server/spec/data_bag_spec.rb +1 -1
- data/examples/server/spec/environment_spec.rb +1 -1
- data/examples/server/spec/exotic_port_spec.rb +1 -1
- data/examples/server/spec/node_spec.rb +4 -4
- data/examples/server/spec/render_with_cached_spec.rb +1 -1
- data/examples/server/spec/role_spec.rb +1 -1
- data/examples/server/spec/search_spec.rb +1 -1
- data/examples/service/spec/disable_spec.rb +1 -1
- data/examples/service/spec/enable_spec.rb +1 -1
- data/examples/service/spec/reload_spec.rb +1 -1
- data/examples/service/spec/restart_spec.rb +1 -1
- data/examples/service/spec/start_spec.rb +1 -1
- data/examples/service/spec/stop_spec.rb +1 -1
- data/examples/smartos_package/spec/install_spec.rb +1 -1
- data/examples/smartos_package/spec/remove_spec.rb +1 -1
- data/examples/smartos_package/spec/upgrade_spec.rb +1 -1
- data/examples/solaris_package/spec/install_spec.rb +1 -1
- data/examples/solaris_package/spec/remove_spec.rb +1 -1
- data/examples/solaris_package/spec/upgrade_spec.rb +1 -1
- data/examples/spec_attributes/attributes/default.rb +1 -0
- data/examples/spec_attributes/recipes/default.rb +5 -0
- data/examples/spec_attributes/spec/default_spec.rb +54 -0
- data/examples/spec_platform/recipes/default.rb +3 -0
- data/examples/spec_platform/spec/default_spec.rb +36 -0
- data/examples/spec_step_into/recipes/default.rb +3 -0
- data/examples/spec_step_into/resources/one.rb +3 -0
- data/examples/spec_step_into/resources/two.rb +3 -0
- data/examples/spec_step_into/spec/default_spec.rb +50 -0
- data/examples/state_attrs/spec/default_spec.rb +1 -1
- data/examples/step_into/spec/default_spec.rb +2 -2
- data/examples/stub_command/spec/default_spec.rb +1 -1
- data/examples/stub_data_bag/spec/default_spec.rb +1 -1
- data/examples/stub_data_bag_item/spec/default_spec.rb +1 -1
- data/examples/stub_node/spec/default_spec.rb +1 -1
- data/examples/stub_search/spec/block_spec.rb +1 -1
- data/examples/stub_search/spec/default_spec.rb +1 -1
- data/examples/stubs_for/resources/default.rb +20 -0
- data/examples/stubs_for/resources/old.rb +26 -0
- data/examples/stubs_for/spec/default_spec.rb +240 -0
- data/examples/subscribes/spec/before_spec.rb +1 -1
- data/examples/subscribes/spec/chained_spec.rb +1 -1
- data/examples/subscribes/spec/default_spec.rb +1 -1
- data/examples/subscribes/spec/delayed_spec.rb +1 -1
- data/examples/subscribes/spec/immediately_spec.rb +1 -1
- data/examples/subversion/spec/checkout_spec.rb +1 -1
- data/examples/subversion/spec/export_spec.rb +1 -1
- data/examples/subversion/spec/force_export_spec.rb +1 -1
- data/examples/subversion/spec/sync_spec.rb +1 -1
- data/examples/systemd_unit/spec/create_spec.rb +1 -1
- data/examples/systemd_unit/spec/delete_spec.rb +1 -1
- data/examples/systemd_unit/spec/disable_spec.rb +1 -1
- data/examples/systemd_unit/spec/enable_spec.rb +1 -1
- data/examples/systemd_unit/spec/mask_spec.rb +1 -1
- data/examples/systemd_unit/spec/reload_or_restart_spec.rb +1 -1
- data/examples/systemd_unit/spec/reload_or_try_restart_spec.rb +1 -1
- data/examples/systemd_unit/spec/restart_spec.rb +1 -1
- data/examples/systemd_unit/spec/start_spec.rb +1 -1
- data/examples/systemd_unit/spec/stop_spec.rb +1 -1
- data/examples/systemd_unit/spec/try_restart_spec.rb +1 -1
- data/examples/systemd_unit/spec/unmask_spec.rb +1 -1
- data/examples/template/spec/create_if_missing_spec.rb +1 -1
- data/examples/template/spec/create_spec.rb +1 -1
- data/examples/template/spec/delete_spec.rb +1 -1
- data/examples/template/spec/touch_spec.rb +1 -1
- data/examples/use_inline_resources/spec/default_spec.rb +1 -1
- data/examples/user/spec/create_spec.rb +1 -1
- data/examples/user/spec/lock_spec.rb +1 -1
- data/examples/user/spec/manage_spec.rb +1 -1
- data/examples/user/spec/modify_spec.rb +1 -1
- data/examples/user/spec/remove_spec.rb +1 -1
- data/examples/user/spec/unlock_spec.rb +1 -1
- data/examples/windows_package/spec/install_spec.rb +1 -1
- data/examples/windows_package/spec/remove_spec.rb +1 -1
- data/examples/windows_service/spec/configure_startup_spec.rb +1 -1
- data/examples/windows_service/spec/disable_spec.rb +1 -1
- data/examples/windows_service/spec/enable_spec.rb +1 -1
- data/examples/windows_service/spec/reload_spec.rb +1 -1
- data/examples/windows_service/spec/restart_spec.rb +1 -1
- data/examples/windows_service/spec/start_spec.rb +1 -1
- data/examples/windows_service/spec/stop_spec.rb +1 -1
- data/examples/yum_package/spec/install_spec.rb +1 -1
- data/examples/yum_package/spec/lock_spec.rb +1 -1
- data/examples/yum_package/spec/purge_spec.rb +1 -1
- data/examples/yum_package/spec/remove_spec.rb +1 -1
- data/examples/yum_package/spec/unlock_spec.rb +1 -1
- data/examples/yum_package/spec/upgrade_spec.rb +1 -1
- data/examples/yum_repository/spec/add_spec.rb +1 -1
- data/examples/yum_repository/spec/create_spec.rb +1 -1
- data/examples/yum_repository/spec/delete_spec.rb +1 -1
- data/examples/yum_repository/spec/makecache_spec.rb +1 -1
- data/examples/yum_repository/spec/remove_spec.rb +1 -1
- data/examples/zypper_package/spec/install_spec.rb +1 -1
- data/examples/zypper_package/spec/lock_spec.rb +1 -1
- data/examples/zypper_package/spec/purge_spec.rb +1 -1
- data/examples/zypper_package/spec/remove_spec.rb +1 -1
- data/examples/zypper_package/spec/unlock_spec.rb +1 -1
- data/examples/zypper_package/spec/upgrade_spec.rb +1 -1
- data/lib/chefspec.rb +1 -1
- data/lib/chefspec/api.rb +33 -14
- data/lib/chefspec/api/core.rb +195 -0
- data/lib/chefspec/api/described.rb +55 -0
- data/lib/chefspec/api/do_nothing.rb +24 -19
- data/lib/chefspec/api/include_recipe.rb +26 -21
- data/lib/chefspec/api/link.rb +26 -21
- data/lib/chefspec/api/notifications.rb +38 -33
- data/lib/chefspec/api/reboot.rb +11 -6
- data/lib/chefspec/api/render_file.rb +35 -30
- data/lib/chefspec/api/state_attrs.rb +28 -23
- data/lib/chefspec/api/stubs.rb +183 -0
- data/lib/chefspec/api/stubs_for.rb +134 -0
- data/lib/chefspec/api/subscriptions.rb +35 -30
- data/lib/chefspec/api/user.rb +222 -217
- data/lib/chefspec/berkshelf.rb +1 -1
- data/lib/chefspec/deprecations.rb +2 -11
- data/lib/chefspec/errors.rb +1 -0
- data/lib/chefspec/extensions.rb +4 -1
- data/lib/chefspec/extensions/chef/client.rb +3 -4
- data/lib/chefspec/extensions/chef/conditional.rb +3 -2
- data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +25 -28
- data/lib/chefspec/extensions/chef/cookbook_loader.rb +13 -0
- data/lib/chefspec/extensions/chef/cookbook_uploader.rb +3 -2
- data/lib/chefspec/extensions/chef/data_query.rb +5 -8
- data/lib/chefspec/extensions/chef/lwrp_base.rb +17 -21
- data/lib/chefspec/extensions/chef/provider.rb +36 -0
- data/lib/chefspec/extensions/chef/resource.rb +51 -4
- data/lib/chefspec/extensions/chef/resource/freebsd_package.rb +13 -16
- data/lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb +64 -0
- data/lib/chefspec/matchers/render_file_matcher.rb +36 -26
- data/lib/chefspec/matchers/resource_matcher.rb +1 -1
- data/lib/chefspec/rspec.rb +3 -8
- data/lib/chefspec/runner.rb +8 -0
- data/lib/chefspec/server_methods.rb +1 -1
- data/lib/chefspec/server_runner.rb +13 -9
- data/lib/chefspec/solo_runner.rb +136 -32
- data/lib/chefspec/version.rb +1 -1
- data/spec/unit/deprecations_spec.rb +1 -26
- data/spec/unit/macros_spec.rb +14 -14
- data/spec/unit/matchers/render_file_matcher_spec.rb +8 -1
- data/spec/unit/solo_runner_spec.rb +3 -3
- data/templates/errors/may_need_to_specify_platform.erb +1 -1
- data/templates/errors/shell_out_not_stubbed.erb +10 -0
- metadata +38 -4
- data/lib/chefspec/macros.rb +0 -222
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'ruby_block::create' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'creates a ruby_block with an explicit action' do
|
7
7
|
expect(chef_run).to create_ruby_block('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'ruby_block::run' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a ruby_block with the default action' do
|
7
7
|
expect(chef_run).to run_ruby_block('default_action')
|
@@ -0,0 +1 @@
|
|
1
|
+
log "worked"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# A simple test to make sure the ChefSpec::Runner name works.
|
2
|
+
|
3
|
+
require 'chefspec'
|
4
|
+
|
5
|
+
describe 'runner' do
|
6
|
+
let(:chef_run) { ChefSpec::Runner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
7
|
+
|
8
|
+
it 'runs the recipe' do
|
9
|
+
expect(chef_run).to write_log('worked')
|
10
|
+
end
|
11
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_bash' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a bash script with the default action' do
|
7
7
|
expect(chef_run).to run_bash('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_csh' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a csh script with the default action' do
|
7
7
|
expect(chef_run).to run_csh('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_ksh' do
|
4
|
-
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a ksh script with the default action' do
|
7
7
|
expect(chef_run).to run_ksh('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_perl' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a perl script with the default action' do
|
7
7
|
expect(chef_run).to run_perl('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_python' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a python script with the default action' do
|
7
7
|
expect(chef_run).to run_python('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_ruby' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a ruby script with the default action' do
|
7
7
|
expect(chef_run).to run_ruby('default_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'script::run_script' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'runs a script with the default action' do
|
7
7
|
expect(chef_run).to run_script('default_action')
|
@@ -2,7 +2,7 @@ require 'chefspec'
|
|
2
2
|
|
3
3
|
describe 'server::client' do
|
4
4
|
let(:chef_run) do
|
5
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |_node, server|
|
6
6
|
server.create_client('bacon', name: 'bacon')
|
7
7
|
end.converge(described_recipe)
|
8
8
|
end
|
@@ -2,7 +2,7 @@ require 'chefspec'
|
|
2
2
|
|
3
3
|
describe 'server::data_bag' do
|
4
4
|
let(:chef_run) do
|
5
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |_node, server|
|
6
6
|
server.create_data_bag('accounts', 'github' => {
|
7
7
|
'username' => 'sethvargo',
|
8
8
|
'password' => 'p@ssW0rd!',
|
@@ -2,7 +2,7 @@ require 'chefspec'
|
|
2
2
|
|
3
3
|
describe 'server::environment' do
|
4
4
|
let(:chef_run) do
|
5
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |_node, server|
|
6
6
|
server.create_environment('production')
|
7
7
|
end.converge(described_recipe)
|
8
8
|
end
|
@@ -2,7 +2,7 @@ require 'chefspec'
|
|
2
2
|
|
3
3
|
describe 'server::node' do
|
4
4
|
let(:chef_run) do
|
5
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |_node, server|
|
6
6
|
server.create_node('bacon', name: 'bacon')
|
7
7
|
end.converge(described_recipe)
|
8
8
|
end
|
@@ -18,7 +18,7 @@ describe 'server::node' do
|
|
18
18
|
|
19
19
|
context 'with custom Ohai data' do
|
20
20
|
let(:chef_run) do
|
21
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
21
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04')
|
22
22
|
.converge(described_recipe)
|
23
23
|
end
|
24
24
|
|
@@ -27,14 +27,14 @@ describe 'server::node' do
|
|
27
27
|
|
28
28
|
node = chef_run.get_node('chefspec')
|
29
29
|
expect(node['kernel']['name']).to eq('Linux')
|
30
|
-
expect(node['kernel']['release']).to match(/4.
|
30
|
+
expect(node['kernel']['release']).to match(/4.15.0-.*-.*/) # avoid failing when fauxhai data changes
|
31
31
|
expect(node['kernel']['machine']).to eq('x86_64')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'with overridden node data' do
|
36
36
|
let(:chef_run) do
|
37
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
37
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |node, _server|
|
38
38
|
node.normal['breakfast']['bacon'] = true
|
39
39
|
end.converge(described_recipe)
|
40
40
|
end
|
@@ -6,7 +6,7 @@ RSpec.configure do |config|
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe 'server::render_with_cached' do
|
9
|
-
cached(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
9
|
+
cached(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
10
10
|
|
11
11
|
it 'does not cache file requests' do
|
12
12
|
expect(chef_run).to render_file('/tmp/file')
|
@@ -2,7 +2,7 @@ require 'chefspec'
|
|
2
2
|
|
3
3
|
describe 'server::role' do
|
4
4
|
let(:chef_run) do
|
5
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |_node, server|
|
6
6
|
server.create_role('webserver')
|
7
7
|
end.converge(described_recipe)
|
8
8
|
end
|
@@ -33,7 +33,7 @@ describe 'server::search' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
let(:chef_run) do
|
36
|
-
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '
|
36
|
+
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '18.04') do |node, server|
|
37
37
|
node.normal['bar'] = true
|
38
38
|
server.update_node(node)
|
39
39
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'service::disable' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'disables a service with an explicit action' do
|
7
7
|
expect(chef_run).to disable_service('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'service::enable' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'enables a service with an explicit action' do
|
7
7
|
expect(chef_run).to enable_service('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'service::reload' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'reloads a service with an explicit action' do
|
7
7
|
expect(chef_run).to reload_service('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'service::restart' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'restarts a service with an explicit action' do
|
7
7
|
expect(chef_run).to restart_service('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'service::start' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'starts a service with an explicit action' do
|
7
7
|
expect(chef_run).to start_service('explicit_action')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'chefspec'
|
2
2
|
|
3
3
|
describe 'service::stop' do
|
4
|
-
let(:chef_run) { ChefSpec::
|
4
|
+
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
|
5
5
|
|
6
6
|
it 'stops a service with an explicit action' do
|
7
7
|
expect(chef_run).to stop_service('explicit_action')
|
@@ -0,0 +1 @@
|
|
1
|
+
default['myapp']['version'] = '1.0'
|
@@ -0,0 +1,54 @@
|
|
1
|
+
describe 'spec_attributes' do
|
2
|
+
platform 'centos', '7.4.1708'
|
3
|
+
|
4
|
+
context 'with no attribute changes' do
|
5
|
+
it { is_expected.to install_package('myapp').with_version('1.0') }
|
6
|
+
it { is_expected.to write_log('version=1.0') }
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'with an extra attribute' do
|
10
|
+
default_attributes['myapp']['other'] = 'foo'
|
11
|
+
|
12
|
+
it { is_expected.to install_package('myapp').with_version('1.0') }
|
13
|
+
it { is_expected.to write_log('other=foo version=1.0') }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with version at the default level' do
|
17
|
+
default_attributes['myapp']['version'] = '2.0'
|
18
|
+
|
19
|
+
it { is_expected.to install_package('myapp').with_version('2.0') }
|
20
|
+
it { is_expected.to write_log('version=2.0') }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with version at the override level' do
|
24
|
+
override_attributes['myapp']['version'] = '2.0'
|
25
|
+
|
26
|
+
it { is_expected.to install_package('myapp').with_version('2.0') }
|
27
|
+
it { is_expected.to write_log('version=2.0') }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'with multiple attributes' do
|
31
|
+
default_attributes['other'] = 'does nothing'
|
32
|
+
default_attributes['myapp']['version'] = '3.0'
|
33
|
+
default_attributes['myapp']['thing1'] = 'one'
|
34
|
+
override_attributes['myapp']['thing2'] = 'two'
|
35
|
+
|
36
|
+
it { is_expected.to install_package('myapp').with_version('3.0') }
|
37
|
+
it { is_expected.to write_log('thing1=one thing2=two version=3.0') }
|
38
|
+
|
39
|
+
context 'in a nested context' do
|
40
|
+
default_attributes['myapp']['thing1'] = 'uno'
|
41
|
+
default_attributes['myapp']['thing2'] = 'dos'
|
42
|
+
|
43
|
+
it { is_expected.to install_package('myapp').with_version('3.0') }
|
44
|
+
it { is_expected.to write_log('thing1=uno thing2=two version=3.0') }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'with setting via a hash' do
|
48
|
+
default_attributes['myapp'] = {thing1: 'un'}
|
49
|
+
|
50
|
+
it { is_expected.to install_package('myapp').with_version('3.0') }
|
51
|
+
it { is_expected.to write_log('thing1=un thing2=two version=3.0') }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
describe 'spec_platform' do
|
2
|
+
context 'with no platform' do
|
3
|
+
before do
|
4
|
+
expect($stderr).to receive(:puts).with(/WARNING: you must specify/)
|
5
|
+
end
|
6
|
+
it { is_expected.to write_log("test").with_message("Hello chefspec 0.6.1") }
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'with an ubuntu platform' do
|
10
|
+
platform 'ubuntu', '18.04'
|
11
|
+
it { is_expected.to write_log("test").with_message('Hello ubuntu 18.04') }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'with a freebsd platform' do
|
15
|
+
platform 'freebsd', '11.2'
|
16
|
+
it { is_expected.to write_log("test").with_message('Hello freebsd 11.2-RELEASE') }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'with a nested platform' do
|
20
|
+
platform 'centos', '7.4.1708'
|
21
|
+
context 'inner' do
|
22
|
+
platform 'redhat', '7.3'
|
23
|
+
it { is_expected.to write_log("test").with_message('Hello redhat 7.3') }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with no version' do
|
28
|
+
platform 'windows'
|
29
|
+
it { is_expected.to write_log("test").with_message(/Hello windows/) }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with a partial version' do
|
33
|
+
platform 'centos', '6'
|
34
|
+
it { is_expected.to write_log("test").with_message('Hello centos 6.9') }
|
35
|
+
end
|
36
|
+
end
|