Skip to content

Commit

Permalink
add response tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rshewitt committed Apr 23, 2024
1 parent 3b78407 commit 9b36bec
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/controllers/translates_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9b36bec

Please sign in to comment.