Skip to content

Commit

Permalink
create post test.
Browse files Browse the repository at this point in the history
  • Loading branch information
rshewitt committed Dec 26, 2023
1 parent 292632e commit 96f38cd
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions test/controllers/translates_controller_test.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 96f38cd

Please sign in to comment.