From 8ae7155218b71d6db08b1ef3e7b7f02f0d3aa965 Mon Sep 17 00:00:00 2001 From: Ana Date: Sun, 13 Mar 2016 01:37:11 +0100 Subject: [PATCH] #name test added --- spec/models/user_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 36c6153a..01038a6e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -33,6 +33,13 @@ describe User do expect(another_user.roles[1]).to eq(cfp_role) end + describe '#name' do + it 'returns the username as name if there is not name' do + user = create(:user, name: nil) + expect(user.name).to eq(user.username) + end + end + describe '#has_role?' do describe 'when user has a role' do it 'returns true when the user has the role' do