Skip to content

Instantly share code, notes, and snippets.

@hemalvarambhia
Created November 24, 2014 14:24
Show Gist options
  • Save hemalvarambhia/2e73c1172c889346fa4e to your computer and use it in GitHub Desktop.
Save hemalvarambhia/2e73c1172c889346fa4e to your computer and use it in GitHub Desktop.
Example usage of the Nginx chefspec matchers
describe "configuration" do
before :each do
@nginx_configuration = chef_run.template(@server_nginx_config_file)
end
describe "server" do
describe "location" do
describe "/" do
it "whitelists requests from Abelson Info servers" do
expect(@nginx_configuration).to whitelist_requests_from(["92.165.78.7", "12.34.56", "24.68.12"]).to_url "/"
end
it "whitelists requests from Abelson Info office machines" do
expect(@nginx_configuration).to whitelist_requests_from(["31.222.42.54.6", "23.45.67", "23.57.11"]).to_url "/"
end
it "blacklists all other requests" do
expect(@nginx_configuration).to blacklist_requests_from(["all"]).to_url "/"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment