I am developing RSpec custom matchers like rspec-dns and rspec-ssltls.
What is the most effective way for testing RSpec custom matchers?
I tests custom matchers(means a test target is a custom matcher). I can tests normal cases of custom matchers like as follows.
rspec_ssltls/have_certificate_spec.rb
## Having certificate
it 'can evaluate having certificate' do
stub_ssl_socket(peer_cert_chain: [nil])
expect('www.example.com:443').not_to have_certificate
stub_ssl_socket(peer_cert_chain: [example_cert])
expect('www.example.com:443').to have_certificate
end
But the RSpec test cases fail if I test error cases. I want to test error cases can be errors.
Aucun commentaire:
Enregistrer un commentaire