1
0
Fork 0

Edit Account#biography

This commit is contained in:
Alex Kotov 2019-02-01 09:23:01 +05:00
parent c1152ffdb4
commit 9605317887
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 14 additions and 3 deletions

View file

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

View file

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

View file

@ -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

View file

@ -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 }