Test::Unit::TestCase
# File test/test_resultsreader.rb, line 15 def assert_results_reader_equals(expected, reader) assert_equal(expected["is_preview"], reader.is_preview?) assert_equal(expected["fields"], reader.fields) n_results = 0 reader.each_with_index do |result, index| n_results += 1 expected_fields = expected["results"][index]["fields"] # The assert of the full data structure below works, but # by default Test::Unit doesn't print the diff of large # data structures, so for debugging purposes it's much # nicer to have each key checked individually as well. expected_fields.each_entry do |key, value| assert_equal([index, key, value], [index, key, result[key]]) end assert_equal(expected_fields, result) assert_equal(expected["results"][index]["RAW_XML"], result.segmented_raw()) end assert_equal(expected["results"].length, n_results) end
Generated with the Darkfish Rdoc Generator 2.