Skip to content

Instantly share code, notes, and snippets.

@bscott
Created June 30, 2012 04:03
Show Gist options
  • Select an option

  • Save bscott/3022191 to your computer and use it in GitHub Desktop.

Select an option

Save bscott/3022191 to your computer and use it in GitHub Desktop.
Chef minitest example
#!/usr/bin/ruby
require 'minitest/spec'
describe_recipe 'audible_magic::default' do
include MiniTest::Chef::Assertions
include MiniTest::Chef::Context
include MiniTest::Chef::Resources
describe "packages" do
# = Checking for package install =
it "installs unzip" do
package("unzip").must_be_installed
end
end
# = Directories =
describe "files" do
# The file existence and permissions matchers are also valid for directories:
it { directory("/var/www/tsv2/shared/extra/").must_exist.with(:owner, "deploy") }
# = Testing that a file exists =
it "creates the linux64bit file" do
file("/var/www/tsv2/shared/extra/linux_64bit.zip").must_exist
end
it "creates the libvss1.so file" do
file("/var/www/tsv2/shared/extra/linux_64bit/libvss1.so").must_exist
end
it "creates the c_c++ file" do
file("/var/www/tsv2/shared/extra/c_c++.zip").must_exist
end
it "creates the c_c++ media2xml lib file" do
file("/var/www/tsv2/shared/extra/c_c++/media2xml-postxml/media2xml.c").must_exist
end
it "creates the lib_3rd file" do
file("/var/www/tsv2/shared/extra/lib_3rd-party.zip").must_exist
end
it "creates the ffmpeg file" do
file("/var/www/tsv2/shared/extra/lib_3rd-party/linux_64bit/ffmpeg").must_exist
end
it "creates the ffmpeg in /usr/local/lib file" do
file("/usr/local/lib/ffmpeg").must_exist
end
it "creates the environment file" do
file("/etc/environment").must_exist
end
# Check file content
it "creates the environment file" do
file("/etc/environment").must_include 'MEDIA2XML_PATH=/var/www/tsv2/shared/extra/c_c++/media2xml-postxml/linux/linux_64bit'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment