diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/controllers/exports_controller_test.rb | 17 | ||||
| -rw-r--r-- | test/fixtures/files/all.txt | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/controllers/exports_controller_test.rb b/test/controllers/exports_controller_test.rb index fe94362..0b0ba1d 100644 --- a/test/controllers/exports_controller_test.rb +++ b/test/controllers/exports_controller_test.rb @@ -42,4 +42,21 @@ class ExportsControllerTest < ActionDispatch::IntegrationTest assert_equal @response.body, file_fixture('underscores.uoc.tex').read end + + test 'plain: works' do + get search_exports_url(0, format: 'txt') + + assert_equal @response.body, file_fixture('all.txt').read.strip + assert_equal 'text/plain', @response.media_type + end + + test 'plain: underscore is removed for the title' do + things(:thing1).update!(title: 'This is a _title_ with _many_ underscores') + + get search_exports_url(0, format: 'txt') + + body = @response.body.split("\n") + + assert_includes body.last, 'This is a title with many underscores' + end end diff --git a/test/fixtures/files/all.txt b/test/fixtures/files/all.txt new file mode 100644 index 0000000..49205a9 --- /dev/null +++ b/test/fixtures/files/all.txt @@ -0,0 +1,2 @@ +Sabaté, Miquel; Nom (eds.) (2024). This is a 2. Dins de Some other thing, 22-24. This is a note 2. Publisher 2, Address 2: 2024. +Sabaté, Miquel; Smith, John; cognom2, Nom cognom1; cognom3 cognom4, Nom (2024). This is a title 1. Dins de Some other thing, 22-24. This is a note 1. Publisher 1. |
