1
0
Fork 0

Edit Account#public_name

This commit is contained in:
Alex Kotov 2019-02-02 02:52:45 +05:00
parent a96c7cfd8a
commit d489697a50
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 12 additions and 3 deletions

View File

@ -6,6 +6,6 @@ class Settings::ProfilePolicy < ApplicationPolicy
end
def permitted_attributes_for_update
%i[username biography]
%i[username public_name biography]
end
end

View File

@ -10,6 +10,7 @@
<div class="form-inputs">
<%= f.input :username, required: true %>
<%= f.input :public_name %>
<%= f.input :biography %>
</div>

View File

@ -7,8 +7,9 @@ RSpec.describe 'PATCH/PUT /settings/profile' do
let :account_attributes do
{
username: Faker::Internet.username(3..36, %w[_]),
biography: Faker::Lorem.paragraph,
username: Faker::Internet.username(3..36, %w[_]),
public_name: Faker::Name.name,
biography: Faker::Lorem.paragraph,
}
end
@ -36,6 +37,13 @@ RSpec.describe 'PATCH/PUT /settings/profile' do
.to(account_attributes[:username])
end
specify do
expect { make_request }.to \
change { current_account.reload.public_name }
.from(current_account.public_name)
.to(account_attributes[:public_name])
end
specify do
expect { make_request }.to \
change { current_account.reload.biography }