FEATURE: Group logs.

This commit is contained in:
Guo Xiang Tan
2016-12-11 23:36:15 +08:00
parent 790f1ef9f3
commit 05f55dbc10
37 changed files with 857 additions and 45 deletions

View File

@ -178,10 +178,16 @@ describe Admin::UsersController do
it 'adds the user to the group' do
xhr :post, :add_group, group_id: group.id, user_id: user.id
expect(response).to be_success
expect(response).to be_success
expect(GroupUser.where(user_id: user.id, group_id: group.id).exists?).to eq(true)
group_history = GroupHistory.last
expect(group_history.action).to eq(GroupHistory.actions[:add_user_to_group])
expect(group_history.acting_user).to eq(@user)
expect(group_history.target_user).to eq(user)
# Doing it again doesn't raise an error
xhr :post, :add_group, group_id: group.id, user_id: user.id
expect(response).to be_success