FIX: improve context when user deletes self

This commit is contained in:
Arpit Jalan
2018-06-18 11:27:51 +05:30
parent 3f167ae5ce
commit f1d1207725
3 changed files with 14 additions and 3 deletions

View File

@@ -71,10 +71,15 @@ describe UserDestroyer do
end
context 'user deletes self' do
let(:destroy_opts) { { delete_posts: true } }
let(:destroy_opts) { { delete_posts: true, context: "/u/username/preferences/account" } }
subject(:destroy) { UserDestroyer.new(@user).destroy(@user, destroy_opts) }
include_examples "successfully destroy a user"
it 'should log proper context' do
destroy
expect(UserHistory.where(action: UserHistory.actions[:delete_user]).last.context).to eq(I18n.t("staff_action_logs.user_delete_self", url: "/u/username/preferences/account"))
end
end
context "with a queued post" do