File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 4
4
expect ( helper . protip_search_results_to_render ( nil ) ) . to be_nil
5
5
end
6
6
end
7
+
8
+ describe '#users_background_image' do
9
+ context 'user is logged in' do
10
+ it 'returns #location_image_url_for @user' do
11
+ assign ( :user , 'test_user' )
12
+ allow ( helper ) . to receive ( :location_image_url_for ) . with ( 'test_user' ) . and_return ( 'image_path' )
13
+ expect ( helper . users_background_image ) . to eq 'image_path'
14
+ end
15
+ end
16
+
17
+ context 'user is not logged in' do
18
+ it 'returns nil' do
19
+ assign ( :user , nil )
20
+ expect ( helper . users_background_image ) . to be_nil
21
+ end
22
+ end
23
+
24
+ context 'protip is set' do
25
+ it 'returns #location_image_url_for @protip.user if @protip is not new_record' do
26
+ @protip = double ( 'protip' , 'user' => 'test_user' , 'new_record?' => false )
27
+ allow ( helper ) . to receive ( :location_image_url_for ) . with ( 'test_user' ) . and_return ( 'image_path' )
28
+ expect ( helper . users_background_image ) . to eq 'image_path'
29
+ end
30
+
31
+ it 'returns nil if @protip is new_record' do
32
+ @protip = double ( 'protip' , 'user' => 'test_user' , 'new_record?' => true )
33
+ expect ( helper . users_background_image ) . to be_nil
34
+ end
35
+ end
36
+
37
+ context 'protip is not set' do
38
+ it 'returns nil' do
39
+ assign ( :protip , nil )
40
+ expect ( helper . users_background_image ) . to be_nil
41
+ end
42
+ end
43
+ end
44
+
7
45
end
You can’t perform that action at this time.
0 commit comments