{"id":13906000,"url":"https://github.com/btm/minitest-handler-cookbook","last_synced_at":"2026-01-10T15:27:40.589Z","repository":{"id":2606924,"uuid":"3590256","full_name":"btm/minitest-handler-cookbook","owner":"btm","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-19T09:09:11.000Z","size":216,"stargazers_count":59,"open_issues_count":12,"forks_count":36,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-25T14:47:27.861Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-01T08:40:57.000Z","updated_at":"2022-02-21T17:19:06.000Z","dependencies_parsed_at":"2023-01-11T16:11:14.992Z","dependency_job_id":null,"html_url":"https://github.com/btm/minitest-handler-cookbook","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/btm/minitest-handler-cookbook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btm%2Fminitest-handler-cookbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btm%2Fminitest-handler-cookbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btm%2Fminitest-handler-cookbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btm%2Fminitest-handler-cookbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btm","download_url":"https://codeload.github.com/btm/minitest-handler-cookbook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btm%2Fminitest-handler-cookbook/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265696669,"owners_count":23812821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T23:01:27.690Z","updated_at":"2026-01-10T15:27:40.511Z","avatar_url":"https://github.com/btm.png","language":"Ruby","readme":"# minitest-handler cookbook\n\n[![Build Status](https://secure.travis-ci.org/btm/minitest-handler-cookbook.png?branch=master)](http://travis-ci.org/btm/minitest-handler-cookbook)\n\nLicense: Apache 2.0 \u003cbr /\u003e\nCopyright: 2012 Opscode, Inc.\u003cbr/\u003e\nAuthor: Bryan McLellan \u003cbtm@loftninjas.org\u003e\u003cbr/\u003e\nAuthor: Bryan W. Berry \u003cbryan.berry@gmail.com\u003e\u003cbr/\u003e\n\n\n## Description\n\nThis cookbook utilizes the minitest-chef-handler project to facilitate\ncookbook testing. By default, minitest-handler will collect all the\ntests in your cookbook_path and run them.\n\nminitest-chef-handler project: https://github.com/calavera/minitest-chef-handler\u003cbr/\u003e\nstable minitest-handler cookbook: http://community.opscode.com/cookbooks/minitest-handler\u003cbr/\u003e\nminitest-handler cookbook development: https://github.com/btm/minitest-handler-cookbook\u003cbr/\u003e\n\n**Note**: Version 0.1.8 deprecated use of\n``files/default/tests/minitest/*_test.rb`` and the location of support\nfiles. Test files should now be located in\n``files/default/test/*_test.rb``\n\n**Note**: Version 0.1.0 added a change that breaks backward compatibility. The minitest-handler now only loads\u003cbr/\u003e\ntest files named \"\u003crecipe-name\u003e_test.rb\" rather than all test files in the path `files/default/test/*_test.rb`\n\nIf you have any helper libraries, they should match `files/default/test/*helper*.rb`\n\n## Attributes\n* `node[:minitest][:gem_version]` - The version of the [minitest](http://rubygems.org/gems/minitest)\n  gem to install and use.\n  * Default: 3.0.1\n* `node[:minitest][:chef_handler_gem_version]` - The version of the [minitest-chef-handler](http://rubygems.org/gems/minitest-chef-handler)\n  gem to install and use.\n  * Default: 1.0.3\n* `node[:minitest][:chef_handler_gem_source]` - Alternate remote source for the minitest-chef-handler gem if not using RubyGems.org.(Ex http://mysource.com/gems')\n  * Default: RubyGems.org\n* `node[:minitest][:ci_reporter_gem_version]` - The version of the [ci_reporter](http://rubygems.org/gems/ci_reporter)\n  gem to install and use.\n  * Default: 1.9.2\n* `node[:minitest][:path]` - Location to store and find test files.\n  * Default: `/var/chef/minitest`\n* `node[:minitest][:recipes]` - The names of all recipes included during the\n  chef run, whether by insertion to the run_list, inclusion through a role, or\n  added with `include_recipe`. If you only want tests for select recipes to run,\n  override this value with the names of the recipes that you want tested.\n  * Default: []\n* `node[:minitest][:filter]` - Filter test names on a pattern (regex)\n  * Default: `nil`\n  * Example: `/apache2/` could be used to *only* run tests for recipes\n    starting with *apache2*\n* `node[:minitest][:seed]` - Set random seed\n  * Default: `nil`\n* `node[:minitest][:ci_reports]` - Path to write out the result of each\n  test in a JUnit-compatible XML file, parseable by many CI platforms\n  * Default: `nil`\n* `node[:minitest][:tests]` - Test files to run.\n  * Default to `**/*_test.rb`\n* `node[:minitest][:verbose]` - Display verbose output\n  * Default: true\n\n## Usage\n* Add ``recipe[minitest-handler]`` somewhere on your run_list, preferably last\n* Place tests in ``files/default/test/`` with the name **your-recipe-name\\_test.rb**\n  (default recipe is named **default_test.rb**)\n* Put any helper functions you have in ``files/default/test/spec_helper.rb`` but\n  minitest-handler will ensure that you have access to any file that\n  matches the glob ``files/test/*helper.rb``\n\n[Minitest](https://github.com/seattlerb/minitest)\n\n## Examples\n### Traditional minitest\n\n    class TestApache2 \u003c MiniTest::Chef::TestCase\n      def test_that_the_package_installed\n        case node[:platform]\n        when \"ubuntu\",\"debian\"\n          assert system('apt-cache policy apache2 | grep Installed | grep -v none')\n        end\n      end\n\n      def test_that_the_service_is_running\n        assert system('/etc/init.d/apache2 status')\n      end\n\n      def test_that_the_service_is_enabled\n        assert File.exists?(Dir.glob(\"/etc/rc5.d/S*apache2\").first)\n      end\n    end\n\n\n\n### Using minitest/spec\n\n    require 'minitest/spec'\n\n    describe_recipe 'ark::test' do\n\n      it \"installed the unzip package\" do\n        package(\"unzip\").must_be_installed\n      end\n\n      it \"dumps the correct files into place with correct owner and group\" do\n        file(\"/usr/local/foo_dump/foo1.txt\").must_have(:owner, \"foobarbaz\").and(:group, \"foobarbaz\")\n      end\n\n     end\n\nFor more detailed examples, see [here](https://github.com/calavera/minitest-chef-handler/blob/v0.4.0/examples/spec_examples/files/default/tests/minitest/example_test.rb)\n\n\n## Testing this cookbook\n\nThis cookbook currently uses [test-kitchen](https://github.com/opscode/test-kitchen)\nalong with the [kitchen-vagrant](https://github.com/opscode/kitchen-vagrant).\n\nAll test are currently written using [BATS](https://github.com/sstephenson/bats),\nwhich is essentially bash. Using BATS was done so that minitest-handler nor\nminitest-chef-handler were used to test itself. For more examples of bats than\nare in this cookbook, see the [chef-rvm](https://github.com/fnichol/chef-rvm),\n[chef-ruby_build](https://github.com/fnichol/chef-ruby_build), and\n[chef-rbenv](https://github.com/fnichol/chef-rbenv) cookbooks.\n\n**NOTE** A known limitation of using BATS is that the cookbook is not currently\ntested on Windows machines. See https://github.com/btm/minitest-handler-cookbook/issues/45\nfor more of the background on this.\n\n## Releasing\nThis cookbook uses an 'even number' release strategy. The version number in master\nwill always be an odd number indicating development, and an even number will\nbe used when an official build is released.\n\nCome release time here is the checklist:\n* Ensure the `metadata.rb` reflects the proper *even* numbered release\n* Ensure there is a *dated* change log entry in `CHANGELOG.md`\n* Commit all the changes\n* Use stove to release (`bundle exec stove`)\n* Bump the version in metadata.rb to the next *patch level* odd number\n\n## Contributors\n* David Petzel \u003cdavidpetzel@gmail.com\u003e\n* Reijo Pitkanen \u003creijop@gmail.com\u003e\n* Jean Mertz \u003cjean@mertz.fm\u003e\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtm%2Fminitest-handler-cookbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtm%2Fminitest-handler-cookbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtm%2Fminitest-handler-cookbook/lists"}