From 96f38cdbf8134f6d5e2e39844b240c02a371dacc Mon Sep 17 00:00:00 2001 From: Reid Hewitt Date: Tue, 26 Dec 2023 15:55:45 -0700 Subject: [PATCH] create post test. --- .../controllers/translates_controller_test.rb | 39 ++++--------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/test/controllers/translates_controller_test.rb b/test/controllers/translates_controller_test.rb index 97b4d30..49f6d12 100644 --- a/test/controllers/translates_controller_test.rb +++ b/test/controllers/translates_controller_test.rb @@ -1,38 +1,13 @@ +# frozen_string_literal: true + require 'test_helper' class TranslatesControllerTest < ActionDispatch::IntegrationTest - setup do - @translate = translates(:one) - end - - test "should get index" do - get translates_url, as: :json - assert_response :success - end - - test "should create translate" do - assert_difference('Translate.count') do - post translates_url, params: { translate: { format: @translate.format, reader: @translate.reader, writer: @translate.writer } }, as: :json - end - - assert_response 201 - end - - test "should show translate" do - get translate_url(@translate), as: :json - assert_response :success - end - - test "should update translate" do - patch translate_url(@translate), params: { translate: { format: @translate.format, reader: @translate.reader, writer: @translate.writer } }, as: :json + 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 assert_response 200 end - - test "should destroy translate" do - assert_difference('Translate.count', -1) do - delete translate_url(@translate), as: :json - end - - assert_response 204 - end end