Edit Account#biography
This commit is contained in:
parent
c1152ffdb4
commit
9605317887
4 changed files with 14 additions and 3 deletions
|
@ -6,6 +6,6 @@ class Settings::ProfilePolicy < ApplicationPolicy
|
|||
end
|
||||
|
||||
def permitted_attributes_for_update
|
||||
%i[username]
|
||||
%i[username biography]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :username, required: true %>
|
||||
<%= f.input :biography %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :guest_account, class: Account
|
||||
factory :guest_account, class: Account do
|
||||
biography { Faker::Lorem.paragraph }
|
||||
end
|
||||
|
||||
factory :usual_account, parent: :guest_account do
|
||||
association :user
|
||||
|
|
|
@ -7,7 +7,8 @@ RSpec.describe 'PATCH/PUT /settings/profile' do
|
|||
|
||||
let :account_attributes do
|
||||
{
|
||||
username: Faker::Internet.username(3..36, %w[_]),
|
||||
username: Faker::Internet.username(3..36, %w[_]),
|
||||
biography: Faker::Lorem.paragraph,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -35,6 +36,13 @@ RSpec.describe 'PATCH/PUT /settings/profile' do
|
|||
.to(account_attributes[:username])
|
||||
end
|
||||
|
||||
specify do
|
||||
expect { make_request }.to \
|
||||
change { current_account.reload.biography }
|
||||
.from(current_account.biography)
|
||||
.to(account_attributes[:biography])
|
||||
end
|
||||
|
||||
context 'after request' do
|
||||
before { make_request }
|
||||
|
||||
|
|
Reference in a new issue