Closed nanduni-nin closed 8 years ago
The extension of the Manifest
class and the schemas looks right.
The verification is not complete, though. It needs to be hooked up to the methods which are called when the verify
command is called from the command line.
The output should not happen in the verificiation method, but with the existing methods printing also the errors. As we want to introduce a warning here, we need to extend this code. Have a look at the Verifier::Results
class.
For testing it would be better to write isolated tests, which don't require modification of test data, which is used by other tests (see e.g. the manifest-all or the count of the manifests). The current admittedly is not great there, as many tests depend on shared test data. We should do this in a cleaner way for new tests.
Maybe it would be helpful to start from an integration test, which specifies what we want to achieve in the end. A test could look like this (in cli_verify_spec.rb
):
it "verifies manifests with topics warning" do
dir = given_directory do
given_directory_from_data("awesomelib", from: "manifests/awesomelib")
given_directory_from_data("missing-topics")
end
result = run_command(args: ["verify", "--offline", "--manifest_dir=#{dir}"])
expected_output = <<EOT
Verify manifest awesomelib.2013-09-08.manifest...ok
Verify manifest missing-topics.manifest...ok
Warning: missing `topics` attribute
2 manifests checked. 1 ok, 0 with error, 1 with warning.
EOT
expect(result).to exit_with_success(expected_output)
end
I added a test for the Verifier::Result
class. This should help with implementing the warning functionality.