From 2cf0ffbffc8442efaba12364a07fc0f5e58b7432 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 20 Mar 2024 11:25:44 +0100 Subject: Support underscore in the exporters on titles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Underscores on titles are meant to be replaced by something else on each exporter (e.g. removed on CSV, or surrounded by \emph on UOC). Signed-off-by: Miquel Sabaté Solà --- test/controllers/exports_controller_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/controllers') diff --git a/test/controllers/exports_controller_test.rb b/test/controllers/exports_controller_test.rb index 9e69df8..eefff6f 100644 --- a/test/controllers/exports_controller_test.rb +++ b/test/controllers/exports_controller_test.rb @@ -15,10 +15,28 @@ class ExportsControllerTest < ActionDispatch::IntegrationTest assert_equal 'text/csv', @response.media_type end + test 'csv: underscore is removed for the title' do + things(:thing1).update!(title: 'This is a _title_ with _many_ underscores') + + get search_exports_url(0, format: 'csv') + + body = @response.body.split("\n") + + assert_equal 'This is a title with many underscores', body.last.split(',')[7] + end + test 'uoc: works' do get search_exports_url(0, format: 'uoc') assert_equal @response.body, file_fixture('all.uoc.tex').read assert_equal 'application/x-tex', @response.media_type end + + test 'uoc: underscore is supported for the title' do + things(:thing1).update!(title: 'This is a _title_ with _many_ underscores') + + get search_exports_url(0, format: 'uoc') + + assert_equal @response.body, file_fixture('underscores.uoc.tex').read + end end -- cgit v1.2.3