|
@@ -47,25 +47,25 @@ class Api::V1::MembershipsControllerTest < ActionDispatch::IntegrationTest
|
47
|
47
|
assert_response :forbidden
|
48
|
48
|
end
|
49
|
49
|
|
50
|
|
- # CREATE
|
51
|
|
- # test "should create membership" do
|
52
|
|
- # assert_difference("Membership.count") do
|
53
|
|
- # post api_v1_memberships_url,
|
54
|
|
- # params: { membership: { team_id: @team2.id, member_id: @user2.id, can_edit: false } },
|
55
|
|
- # headers: { Authorization: JsonWebToken.encode(user_id: @user.id) },
|
56
|
|
- # as: :json
|
57
|
|
- # end
|
58
|
|
- # assert_response :created
|
59
|
|
- # end
|
|
50
|
+ #CREATE
|
|
51
|
+ test "should create membership" do
|
|
52
|
+ assert_difference("Membership.count") do
|
|
53
|
+ post api_v1_team_memberships_url(@team),
|
|
54
|
+ params: { membership: { can_edit: false, member_id: @user2, team_id: @team } },
|
|
55
|
+ headers: { Authorization: JsonWebToken.encode(user_id: @user2.id) },
|
|
56
|
+ as: :json
|
|
57
|
+ end
|
|
58
|
+ assert_response :created
|
|
59
|
+ end
|
60
|
60
|
|
61
|
|
- # test "should forbid create membership" do
|
62
|
|
- # assert_no_difference("Membership.count") do
|
63
|
|
- # post api_v1_memberships_url,
|
64
|
|
- # params: { membership: { team_id: @team.id, member_id: @user.id, can_edit: false } },
|
65
|
|
- # as: :json
|
66
|
|
- # end
|
67
|
|
- # assert_response :forbidden
|
68
|
|
- # end
|
|
61
|
+ test "should forbid create membership" do
|
|
62
|
+ assert_no_difference("Membership.count") do
|
|
63
|
+ post api_v1_team_memberships_url(@team),
|
|
64
|
+ params: { membership: { can_edit: false } },
|
|
65
|
+ as: :json
|
|
66
|
+ end
|
|
67
|
+ assert_response :forbidden
|
|
68
|
+ end
|
69
|
69
|
|
70
|
70
|
# # UPDATE
|
71
|
71
|
# test "should update membership" do
|