From 9b36beca831569ce31eabe49c7ba303115cbff8e Mon Sep 17 00:00:00 2001 From: Reid Hewitt Date: Tue, 23 Apr 2024 16:20:12 -0600 Subject: [PATCH] add response tests --- test/controllers/translates_controller_test.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/controllers/translates_controller_test.rb b/test/controllers/translates_controller_test.rb index 49f6d12..ef51565 100644 --- a/test/controllers/translates_controller_test.rb +++ b/test/controllers/translates_controller_test.rb @@ -3,11 +3,17 @@ require 'test_helper' class TranslatesControllerTest < ActionDispatch::IntegrationTest - test 'post transformation of fgdc to iso19115_3' do - @translate = translates(:fgdc_to_iso) - @file = File.read(File.expand_path("../../fixtures/#{@translate.file}", __FILE__)) - post '/translates', params: { translate: { file: @file, - reader: @translate.reader, writer: @translate.writer } }, as: :json + test 'post valid transformation of sbJson to mdJson' do + @translate = translates(:sbjson_to_mdjson) + @file = File.read(File.join(File.dirname(__FILE__), "../fixtures/#{@translate.file}")) + post '/translates', params: { file: @file, reader: @translate.reader, writer: @translate.writer }, as: :json assert_response 200 end + + test 'post invalid transformation of fgdc to iso19115_3' do + @translate = translates(:fgdc_to_iso) + @file = File.read(File.join(File.dirname(__FILE__), "../fixtures/#{@translate.file}")) + post '/translates', params: { file: @file, reader: @translate.reader, writer: @translate.writer }, as: :json + assert_response 422 + end end