Chefspec Versions Save

Write RSpec examples and generate coverage reports for Chef recipes!

v3.1.0.beta.1

10 years ago

v3.0.2

10 years ago

Bugfixes:

  • Update links to point at new repository location
  • Deleted relish docs to remove confusion
  • Bump fauxhai dependency to 2.0 (removing the HTTParty transitive dependency)
  • Convert resource names with dashes to underscores when stepping into them

Improvements:

  • Added a "what people are saying" section to the README - if you have something cool to say about ChefSpec, let me know!
  • Add a link to knife-spec
  • Test against Chef 11.8
  • New matcher: have_state_attrs for testing custom LWRP state attributes
  • Run tests in a sandboxed parent instead of tmp (makes Travis happier)

v3.0.1

10 years ago

Bugfixes:

  • Fix an issue where LWRPs were not properly stepped into when use_inline_resources was specified (#244)
  • Coerce render_file @expected_content to a string before asserting if content is included (#243)

Improvements:

  • Miscellaneous documentation fixes and additions (#245, #241, #238)

v3.0.0

10 years ago

Breaking:

  • Renamed ChefSpec::ChefRunner to ChefSpec::Runner to better reflect what happens in Chef Core. Using ChefRunner will throw deprecation errors for now and will be removed in a future release.
  • Removed MiniTest Chef Handler examples/matchers
  • No longer load default cookbook paths:
    • vendor/cookbooks
    • test/cookbooks
    • test/integration (test kitchen)
    • spec/cookbooks
  • Resource matchers all follow the pattern "(action)_(resource_name)". ChefSpec will warn you of these deprecations in 3.0. They will be removed in 4.0. However, some resources cannot be automatically converted - these resources will raise a deprecation exception of ChefSpec::NoConversionError. The following matchers have changed:
    • execute_command => run_execute
    • set_service_to_start_on_boot => enable_service
    • create_file_with_content => render_file
    • execute_(script) => run_(script)
    • execute_ruby_block => run_ruby_block
    • install_package_at_version => install_package().with(version: '')
    • *_python_pip => (removed - see "Packaging Custom LWRPs in the README")
  • Remove dependency on Erubis
  • Remove dependency on MiniTest Chef Handler
  • Remove development dependency on Cucumber
  • Remove development dependency on i18n
  • Remove development dependency on simplecov
  • Separate package matchers. In prior versions of ChefSpec, the package matcher would match on any kind of package and any kind of package action. However, some subclasses of the package resource do not support all actions. Each package provider now has it's own matcher with only the actions it supports. Prior specs that used the generic package matcher will no longer match on subclasses - you must use the specific subclass matcher.
  • Separate file/cookbook_file/template matchers. In prior versions of ChefSpec, the file matcher would match on file, cookbook_file, and template. This is not ideal because it doesn't verify the correct message was sent. Now, file, cookbook_file, and template matchers will only match resources of that type. For generic file checking, please use the new render_file matcher.
  • Guards are now evaluated by default. If a shell guard is executed, it must first be stubbed with the stub_command macro.
  • Runner#resources converted from an Array to a Hash. This is to ensure that all resource actions are added (when multiple calls to run_action exist (#201)). This also drastically improves resource lookup times.
  • Resource#actions is no longer maniuplated. Instead, a new method Resource#performed_actions now keeps track of the actions taken on a resource (as well as the phase in which they were taken), preserving the original state of the resource.

Features:

  • Added a new render_file action to replace create_file_with_content. This matcher will render the contents of any file to a string and then optionally compare the result if given a with chainable.
  • All resources now accept a with chainable for matching specific resource attributes.
  • Windows attributes are now testable on non-Windows systems (like inherits)
  • Added batch resource matchers
  • Added cookbook_file resource matchers
  • Added deploy resource matchers
  • Added erl_call resource matchers
  • Added git resource matchers
  • Added http_request resource matchers
  • Added ifconfig resource matchers
  • Normalized link resource matchers
  • Added log resource matchers
  • Added mdadm resource matchers
  • Added mount resource matchers
  • Added :immediate and :delayed notification matchers
  • Added ohai resource matchers
  • Added powershell_script matchers (Chef 11.6+)
  • Added registry_key matchers
  • Added remote_directory matchers
  • Added route matchers
  • Added subversion matchers
  • Added stub_command macro (formerly on ChefSpec::ChefRunner) for stubbbing the results of shell commands. Because shell commands are evaluated by default, ChefSpec will raise an exception when encountering a shell command that has not been stubbed.
  • Added stub_search macro for easily stubbing search calls. Like shell commands, ChefSpec will raise an exception when encountering a search call that has not been stubbed.
  • Added stub_data_bag macro for easily stubbing data_bag calls. Like shell commands, ChefSpec will raise an exception when encountering a data_bag call that has not been stubbed.
  • Added stub_data_bag_item macro for easily stubbingdata_bag_item calls. Like shell commands, ChefSpec will raise an exception when encountering a data_bag_item call that has not been stubbed.
  • Added stub_node helper for quickly generating a node object from Fauxhai data
  • Added ChefSpec::Runner#apply command to mimic the behavior of chef-apply (use with caution)
  • Share the ChefSpec::Runner object with the Node object
  • Add chefspec/berkshelf for easily integrating specs with Berkshelf (2 & 3)
  • Add .at_compile_time and .at_converge_time matchers for asserting which phase of the Chef run a resource should be run

Improvements:

  • Move to inline documentation (Yard)
  • Implement InProcess Aruba testing for ultra-fast tests
  • Create "examples" directory for testing and demonstration
  • Unified all failure_messages_for_should
  • Use shared_examples for easily testing defined custom matchers
  • Infer the cookbook_path from the calling spec
  • Directly set node attributes with Fauxhai (formerly this was an O(n) operation)
  • Refactored ExpectExpectation to work without stubbing
  • Use Chef's resource_collection to identify resources instead of our own custom proxy