From a7791635aa98f012d35f97c3c5288494bbb28e38 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 13 Mar 2024 18:03:43 +0100 Subject: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- test/system/shared_searches_test.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/system/shared_searches_test.rb (limited to 'test/system/shared_searches_test.rb') 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 -- cgit v1.2.3