Merge remote-tracking branch 'parent/main' into upstream-20231206

This commit is contained in:
KMY 2023-12-06 12:49:55 +09:00
commit 0199608b87
61 changed files with 781 additions and 162 deletions

View file

@ -21,12 +21,19 @@ RSpec.describe 'Account actions' do
it 'logs action' do
subject
log_item = Admin::ActionLog.last
expect(latest_admin_action_log)
.to be_present
.and have_attributes(
action: eq(action_type),
account_id: eq(user.account_id),
target_id: eq(target_type == :user ? target_account.user.id : target_account.id)
)
end
expect(log_item).to be_present
expect(log_item.action).to eq(action_type)
expect(log_item.account_id).to eq(user.account_id)
expect(log_item.target_id).to eq(target_type == :user ? target_account.user.id : target_account.id)
private
def latest_admin_action_log
Admin::ActionLog.last
end
end

View file

@ -151,12 +151,13 @@ RSpec.describe 'Accounts' do
it 'logs action', :aggregate_failures do
subject
log_item = Admin::ActionLog.last
expect(log_item).to be_present
expect(log_item.action).to eq :approve
expect(log_item.account_id).to eq user.account_id
expect(log_item.target_id).to eq account.user.id
expect(latest_admin_action_log)
.to be_present
.and have_attributes(
action: eq(:approve),
account_id: eq(user.account_id),
target_id: eq(account.user.id)
)
end
end
@ -202,12 +203,13 @@ RSpec.describe 'Accounts' do
it 'logs action', :aggregate_failures do
subject
log_item = Admin::ActionLog.last
expect(log_item).to be_present
expect(log_item.action).to eq :reject
expect(log_item.account_id).to eq user.account_id
expect(log_item.target_id).to eq account.user.id
expect(latest_admin_action_log)
.to be_present
.and have_attributes(
action: eq(:reject),
account_id: eq(user.account_id),
target_id: eq(account.user.id)
)
end
end
@ -398,4 +400,10 @@ RSpec.describe 'Accounts' do
end
end
end
private
def latest_admin_action_log
Admin::ActionLog.last
end
end

View file

@ -140,8 +140,11 @@ RSpec.describe 'Lists' do
it_behaves_like 'forbidden for wrong scope', 'read read:lists'
it 'returns the updated list', :aggregate_failures do
subject
it 'returns the updated list and updates values', :aggregate_failures do
expect { subject }
.to change_list_title
.and change_list_replies_policy
.and change_list_exclusive
expect(response).to have_http_status(200)
list.reload
@ -156,16 +159,16 @@ RSpec.describe 'Lists' do
})
end
it 'updates the list title' do
expect { subject }.to change { list.reload.title }.from('my list').to('list')
def change_list_title
change { list.reload.title }.from('my list').to('list')
end
it 'updates the list replies_policy' do
expect { subject }.to change { list.reload.replies_policy }.from('list').to('followed')
def change_list_replies_policy
change { list.reload.replies_policy }.from('list').to('followed')
end
it 'updates the list exclusive' do
expect { subject }.to change { list.reload.exclusive }.from(false).to(true)
def change_list_exclusive
change { list.reload.exclusive }.from(false).to(true)
end
context 'when the list does not exist' do