master
1describe "stronglifters::nginx" do
2 let(:domain) { "www.example.com" }
3 subject do
4 ChefSpec::SoloRunner.new do |node|
5 node.set["nginx"]["domain"] = domain
6 end.converge(described_recipe)
7 end
8
9 it "installs nginx" do
10 expect(subject).to install_package("nginx")
11 end
12
13 it "copies the ssl certificate" do
14 expect(subject).to create_file("/etc/ssl/certs/#{domain}.crt")
15 end
16
17 it "copies the ssl private key" do
18 expect(subject).to create_file("/etc/ssl/private/#{domain}.key")
19 end
20
21 it "adds the configuration for the website" do
22 expect(subject).to create_template("/etc/nginx/nginx.conf")
23 end
24
25 it "restarts nginx" do
26 resource = subject.template("/etc/nginx/nginx.conf")
27 expect(resource).to notify("service[nginx]").to(:restart).delayed
28 end
29
30 it "starts nginx" do
31 expect(subject).to start_service("nginx")
32 end
33
34 it "creates the log directory for nginx" do
35 expect(subject).to create_directory("/var/log/nginx")
36 end
37
38 it "adds the logrotate config for rotating nginx logs" do
39 expect(subject).to create_template("/etc/logrotate.d/nginx")
40 end
41end