aboutsummaryrefslogtreecommitdiff
path: root/test/system/shared_searches_test.rb
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2024-03-13 18:03:43 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2024-03-13 18:03:43 +0100
commita7791635aa98f012d35f97c3c5288494bbb28e38 (patch)
treebad987e6b4d10ad2f7cd02e40658d464907595ee /test/system/shared_searches_test.rb
downloadoperum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz
operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'test/system/shared_searches_test.rb')
-rw-r--r--test/system/shared_searches_test.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/system/shared_searches_test.rb b/test/system/shared_searches_test.rb
new file mode 100644
index 0000000..0cfc4bd
--- /dev/null
+++ b/test/system/shared_searches_test.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require 'application_system_test_case'
+
+class SharedSearchesTest < ApplicationSystemTestCase
+ test 'can access shared_searches#index from the hidden menu' do
+ sign_in!
+
+ find('#toggle-hidden-global-menu').click
+ assert_text I18n.t('searches.shared.title').downcase
+
+ click_on I18n.t('searches.shared.title').downcase
+ assert_text I18n.t('searches.shared.none')
+ end
+
+ test 'cannot access shared_searches#index if not logged in' do
+ sign_out_maybe!
+
+ visit shared_searches_path
+ assert_text I18n.t('sessions.title')
+ assert page.current_path == new_sessions_path
+ end
+
+ test 'shared_searches#show gives us the expected results' do
+ # NOTE: not logged in!
+
+ searches(:search1).update!(shared: true)
+
+ visit search_shared_path(searches(:search1))
+ assert_text things(:thing1).title
+ assert_text things(:thing2).title
+ assert_text I18n.t('comments.title')
+ end
+end