From 489a2830f10fffff8079e57c8e739f10a29d99b8 Mon Sep 17 00:00:00 2001 From: jiangplus Date: Tue, 10 Sep 2024 22:14:48 +0800 Subject: [PATCH] format code --- test/controllers/api/group_controller_test.rb | 8 +++----- .../api/group_invite_controller_test.rb | 19 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/test/controllers/api/group_controller_test.rb b/test/controllers/api/group_controller_test.rb index 1fde63f..1fa5190 100644 --- a/test/controllers/api/group_controller_test.rb +++ b/test/controllers/api/group_controller_test.rb @@ -1,7 +1,6 @@ require "test_helper" class Api::GroupControllerTest < ActionDispatch::IntegrationTest - test "api#group/create" do profile = Profile.find_by(handle: "cookie") auth_token = profile.gen_auth_token @@ -11,7 +10,7 @@ class Api::GroupControllerTest < ActionDispatch::IntegrationTest timezone: "asia/shanghai", can_publish_event: "all", can_join_event: "all", - can_view_event: "all", + can_view_event: "all" } } assert_response :success group = Group.find_by(handle: "newworld") @@ -30,7 +29,7 @@ class Api::GroupControllerTest < ActionDispatch::IntegrationTest post api_group_update_url, params: { auth_token: auth_token, id: group.id, group: { - timezone: "asia/hongkong", + timezone: "asia/hongkong" } } assert_response :success end @@ -277,7 +276,7 @@ class Api::GroupControllerTest < ActionDispatch::IntegrationTest post api_group_send_invite_url, params: { auth_token: auth_token, group_id: group.id, - receivers: [profile2.handle], role: 'member', message: "welcome" } + receivers: [ profile2.handle ], role: "member", message: "welcome" } assert_response :success group_invite = GroupInvite.find_by(receiver: profile2) @@ -288,5 +287,4 @@ class Api::GroupControllerTest < ActionDispatch::IntegrationTest assert group.is_member(profile2.id) end - end diff --git a/test/controllers/api/group_invite_controller_test.rb b/test/controllers/api/group_invite_controller_test.rb index 361a6dd..63692d1 100644 --- a/test/controllers/api/group_invite_controller_test.rb +++ b/test/controllers/api/group_invite_controller_test.rb @@ -1,18 +1,17 @@ require "test_helper" class Api::GroupInviteControllerTest < ActionDispatch::IntegrationTest - test "api/group/send_invite" do profile = Profile.find_by(handle: "cookie") auth_token = profile.gen_auth_token group = Group.find_by(handle: "guildx") - assert_difference 'GroupInvite.count', 1 do + assert_difference "GroupInvite.count", 1 do post api_group_send_invite_url, params: { auth_token: auth_token, group_id: group.id, role: "member", - receivers: ["mooncake"], + receivers: [ "mooncake" ], message: "please join the group" } end @@ -29,12 +28,12 @@ class Api::GroupInviteControllerTest < ActionDispatch::IntegrationTest Membership.create(profile_id: profile2.id, group_id: group.id, role: "member", status: "active") - assert_difference 'GroupInvite.count', 0 do + assert_difference "GroupInvite.count", 0 do post api_group_send_invite_url, params: { auth_token: auth_token, group_id: group.id, role: "manager", - receivers: ["mooncake"], + receivers: [ "mooncake" ], message: "please join the group" } end @@ -50,12 +49,12 @@ class Api::GroupInviteControllerTest < ActionDispatch::IntegrationTest Membership.create(profile_id: profile2.id, group_id: group.id, role: "manager", status: "active") - assert_difference 'GroupInvite.count', 0 do + assert_difference "GroupInvite.count", 0 do post api_group_send_invite_url, params: { auth_token: auth_token, group_id: group.id, role: "member", - receivers: ["mooncake"], + receivers: [ "mooncake" ], message: "please join the group" } end @@ -69,12 +68,12 @@ class Api::GroupInviteControllerTest < ActionDispatch::IntegrationTest auth_token = profile.gen_auth_token group = Group.find_by(handle: "guildx") - assert_difference 'GroupInvite.count', 1 do + assert_difference "GroupInvite.count", 1 do post api_group_send_invite_url, params: { auth_token: auth_token, group_id: group.id, role: "manager", - receivers: ["dimsum@mail.com"], + receivers: [ "dimsum@mail.com" ], message: "please join the group" } end @@ -162,7 +161,6 @@ class Api::GroupInviteControllerTest < ActionDispatch::IntegrationTest assert_equal "requesting", group_invite.status assert_equal "member", group_invite.role assert_equal "I would like to join the group", group_invite.message - end test "api/group/accept_request" do @@ -185,5 +183,4 @@ class Api::GroupInviteControllerTest < ActionDispatch::IntegrationTest assert membership assert_equal "member", membership.role end - end