aboutsummaryrefslogtreecommitdiff
path: root/test/system/shared_searches_test.rb
diff options
context:
space:
mode:
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