0

I'm using the following ruby script

describe command('curl -s -k - i %{http_code} https://localhost/xx/xxx') do
  its(:stdout) { should match /200/ }
end

But I'm unsure if this script works or not. How can I make sure this script works?

Alex Harvey
  • 14,494
  • 5
  • 61
  • 97
  • 1
    run it via `bundle exec rspec path/to/the/file_spec.rb` – Anthony Sep 04 '18 at 17:49
  • @Anthony thanks for the reply. But I'm sorry not to mention this in the question. I want to know whether the curl command gives the http code. In the meanwhile, I'll be running the script as you suggested.! – Beginnerprogrammer Sep 04 '18 at 19:12

2 Answers2

1

Generally Serverspec is used with Chef via the Test Kitchen integration testing framework (though these days InSpec is more popular). You run your tests using the kitchen verify command.

coderanger
  • 52,400
  • 4
  • 52
  • 75
0

It looks to me like what you want is:

describe command('curl -s -k -I https://localhost/xx/xxx') do
  its(:stdout) { should match /200/ }
end
Alex Harvey
  • 14,494
  • 5
  • 61
  • 97