diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
| commit | a7791635aa98f012d35f97c3c5288494bbb28e38 (patch) | |
| tree | bad987e6b4d10ad2f7cd02e40658d464907595ee /test/controllers | |
| download | operum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip | |
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'test/controllers')
| -rw-r--r-- | test/controllers/exports_controller_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/controllers/exports_controller_test.rb b/test/controllers/exports_controller_test.rb new file mode 100644 index 0000000..42ed1a2 --- /dev/null +++ b/test/controllers/exports_controller_test.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class ExportsControllerTest < ActionDispatch::IntegrationTest + # We need the session to be initialized as a signed in user. + setup { post sessions_url, params: { username: users(:user).username, password: '12341234' } } + + test 'csv: works' do + get search_exports_url(0, format: 'csv') + + body = @response.body.split("\n") + assert body.size == 2 + assert body.first.split(',')[0] == things(:thing2).target + assert body.last.split(',')[0] == things(:thing1).target + + assert @response.media_type == 'text/csv' + end + + test 'uoc: works' do + get search_exports_url(0, format: 'uoc') + + assert @response.body == file_fixture('all.uoc.tex').read + assert @response.media_type == 'application/x-tex' + end +end |
