diff --git a/spec/views/projects/_home_panel.html.haml_spec.rb b/spec/views/projects/_home_panel.html.haml_spec.rb
index 5af57cdf3b75784a177afb5cd40b1d4ffb8ead63..f5381a482079f406c8011069ee4692ffc4975fdf 100644
--- a/spec/views/projects/_home_panel.html.haml_spec.rb
+++ b/spec/views/projects/_home_panel.html.haml_spec.rb
@@ -4,7 +4,7 @@ describe 'projects/_home_panel', :view do
   let(:project) { create(:empty_project, :public) }
 
   let(:notification_settings) do
-    user.notification_settings_for(project) if user
+    user&.notification_settings_for(project)
   end
 
   before do