diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-07-01 08:40:49 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-07-01 08:53:56 +0200 |
| commit | 34e16b7d7a88013578014be0402ab686b03f235b (patch) | |
| tree | 5ef848d3c44f72ff95a24b123e5da88bc5aef1a2 /test/controllers | |
| parent | 24714068efc5866999311ad482d54f5c7a90c449 (diff) | |
| download | operum-34e16b7d7a88013578014be0402ab686b03f235b.tar.gz operum-34e16b7d7a88013578014be0402ab686b03f235b.zip | |
lib: Introduce the PlainExporter
This class exports things into plain text. It follows a close format to
that of the one for UOC, but without any formatting.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'test/controllers')
| -rw-r--r-- | test/controllers/exports_controller_test.rb | 17 |
1 files changed, 17 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 |
