From bd578d96b47c9fadd91fa95a7913bf65f3623128 Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Fri, 18 Aug 2017 10:31:59 -0700 Subject: Add namespace errors from User#after_update --- spec/models/user_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spec/models') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c4bf9ebf25e..9a9e255f874 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2063,10 +2063,15 @@ describe User do context 'when there is a validation error (namespace name taken) while updating namespace' do let!(:conflicting_namespace) { create(:group, name: new_username, path: 'quz') } - it "causes the user save to fail" do + it 'causes the user save to fail' do expect(user.update_attributes(username: new_username)).to be_falsey expect(user.namespace.errors.messages[:name].first).to eq('has already been taken') end + + it 'adds the namespace errors to the user' do + user.update_attributes(username: new_username) + expect(user.errors.full_messages.first).to eq('Namespace name has already been taken') + end end end -- cgit v1.2.1