From 3eb645a590726487d7239c72ac4453ca6e40c3c5 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 2 Jun 2021 14:43:29 +0500 Subject: [PATCH] Refactor schema checking to custom assertion --- test/integration/epp/domain/info/base_test.rb | 5 +---- test/test_helper.rb | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/integration/epp/domain/info/base_test.rb b/test/integration/epp/domain/info/base_test.rb index 214cdfb6f..4aaa6c8ba 100644 --- a/test/integration/epp/domain/info/base_test.rb +++ b/test/integration/epp/domain/info/base_test.rb @@ -116,10 +116,7 @@ class EppDomainInfoBaseTest < EppTestCase response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - schema = EPP_ALL_SCHEMA - - schema_validation_errors = schema.validate(response_xml) - assert_equal 0, schema_validation_errors.size + assert_correct_against_schema response_xml end def test_returns_valid_response_if_release_prohibited diff --git a/test/test_helper.rb b/test/test_helper.rb index a8ed1a3ca..16eda7fc3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -75,6 +75,13 @@ class EppTestCase < ActionDispatch::IntegrationTest assert schema_version >= version end + def assert_correct_against_schema(response_xml, message = nil) + schema = EPP_ALL_SCHEMA + + schema_validation_errors = schema.validate(response_xml) + assert_equal 0, schema_validation_errors.size, message + end + private def prefix_schema_tag(prefix, response_xml)