diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-07-22 16:59:37 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-07-22 16:59:37 +0200 |
| commit | 8d954606eaf3cf80f2e1374a475b18dcaf79eec0 (patch) | |
| tree | 69a6ddb02055e1a7d200ac57b342764be8d794cd /test/controllers | |
| parent | 972f45d97221e1d63f5729602e1f91e3bdfa223c (diff) | |
| download | operum-8d954606eaf3cf80f2e1374a475b18dcaf79eec0.tar.gz operum-8d954606eaf3cf80f2e1374a475b18dcaf79eec0.zip | |
Do not allow to show non-shared searches
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'test/controllers')
| -rw-r--r-- | test/controllers/shared_searches_controller_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/controllers/shared_searches_controller_test.rb b/test/controllers/shared_searches_controller_test.rb new file mode 100644 index 0000000..e432316 --- /dev/null +++ b/test/controllers/shared_searches_controller_test.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class SharedSearchesControllerTest < 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 'does not allow to show searches which have not been shared' do + get search_shared_url(searches(:search1).id) + assert_equal @response.code.to_i, 404 + + searches(:search1).update!(shared: true) + + get search_shared_url(searches(:search1).id) + assert_equal @response.code.to_i, 200 + end +end |
