Commit 657bc805 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add json support to group members leave action in controller

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 323a326c
......@@ -51,9 +51,14 @@ module MembershipActions
"You left the \"#{membershipable.human_name}\" #{source_type}."
end
redirect_path = member.request? ? member.source : [:dashboard, membershipable.class.to_s.tableize]
respond_to do |format|
format.html do
redirect_path = member.request? ? member.source : [:dashboard, membershipable.class.to_s.tableize]
redirect_to redirect_path, notice: notice
end
redirect_to redirect_path, notice: notice
format.json { head :ok }
end
end
protected
......
......@@ -124,6 +124,13 @@ describe Groups::GroupMembersController do
expect(response).to redirect_to(dashboard_groups_path)
expect(group.users).not_to include user
end
it 'supports json request' do
delete :leave, group_id: group, format: :json
expect(response).to have_http_status(200)
expect(response.body).to be_empty
end
end
context 'and is an owner' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment