blob: 5a8cc3ed37bb5877162be9fff26c60dcd1e99e24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# 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 'shared_searches#index shows the searches at the top bar when logged in' do
assert_no_text searches(:search1).name
sign_in!
find('#toggle-hidden-global-menu').click
click_on I18n.t('searches.shared.title').downcase
assert_text searches(:search1).name
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_equal 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
|