diff options
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/users/update_service_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/services/users/update_service_spec.rb b/spec/services/users/update_service_spec.rb index 50bbb16e368..5cd6283ca96 100644 --- a/spec/services/users/update_service_spec.rb +++ b/spec/services/users/update_service_spec.rb @@ -55,6 +55,15 @@ describe Users::UpdateService do expect(result[:message]).to eq("Emoji is not included in the list") end + it 'ignores read-only attributes' do + allow(user).to receive(:read_only_attribute?).with(:name).and_return(true) + + expect do + update_user(user, name: 'changed' + user.name) + user.reload + end.not_to change { user.name } + end + def update_user(user, opts) described_class.new(user, opts.merge(user: user)).execute end |