23. require 'chefspec'
describe 'http_server::default' do
let (:chef_run) {
ChefSpec::ChefRunner.new.converge
'http_server::default‘
}
it 'should install nginx' do
expect(chef_run).to install_package 'nginx'
end
it 'should start nginx' do
expect(chef_run).to start_service 'nginx'
end
end
25. class TestNginx < MiniTest::Chef::TestCase
def test_package_is_installed
assert_installed package("nginx")
end
def test_service_is_running
assert_running service("nginx")
end
end
34. describe Array, "when empty" do
before do
@empty_array = []
end
it "should be empty" do
expect(@empty_array).to be_empty
end
it "should size 0" do
expect(@empty_array.size).to eq 0
end
end
36. describe package('httpd') do
it { should be_installed }
end
describe service('httpd') do
it { should be_enabled }
it { should be_running }
end
describe port(80) do
it { should be_listening }
end