From 525cb4826fd6bd4a9045626805c971eefc20ca58 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley Date: Fri, 6 Oct 2017 12:11:22 +0100 Subject: [PATCH] Code review refactoring --- app/models/enterprise_role.rb | 2 +- spec/controllers/user_registrations_controller_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/enterprise_role.rb b/app/models/enterprise_role.rb index 1cb23ba738..c283a12b1d 100644 --- a/app/models/enterprise_role.rb +++ b/app/models/enterprise_role.rb @@ -17,7 +17,7 @@ class EnterpriseRole < ActiveRecord::Base managers_for(enterprise_id).map do |m| if m.user_id == user_id.to_i m.update_attributes receives_notifications: true - elsif m.user_id != user_id.to_i && m.receives_notifications + elsif m.receives_notifications m.update_attributes receives_notifications: false end end diff --git a/spec/controllers/user_registrations_controller_spec.rb b/spec/controllers/user_registrations_controller_spec.rb index c2239623b5..578ff27214 100644 --- a/spec/controllers/user_registrations_controller_spec.rb +++ b/spec/controllers/user_registrations_controller_spec.rb @@ -21,6 +21,7 @@ describe UserRegistrationsController, type: :controller do response.status.should == 200 json = JSON.parse(response.body) json.should == {"email" => "test@test.com"} + expect(controller.spree_current_user).to be_nil end end