Skip to content

Commit 124bd7b

Browse files
authored
Merge pull request #780 from code-corps/445-assert-id-helper
Fixes 445 with assert-id helper change
2 parents 09693c5 + f3f5210 commit 124bd7b

24 files changed

+35
-59
lines changed

test/controllers/category_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ defmodule CodeCorps.CategoryControllerTest do
2222
conn
2323
|> request_show(category)
2424
|> json_response(200)
25-
|> Map.get("data")
26-
|> assert_result_id(category.id)
25+
|> assert_id_from_response(category.id)
2726
end
2827

2928
test "renders 404 when id is nonexistent", %{conn: conn} do

test/controllers/comment_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ defmodule CodeCorps.CommentControllerTest do
3232
conn
3333
|> request_show(comment)
3434
|> json_response(200)
35-
|> Map.get("data")
36-
|> assert_result_id(comment.id)
35+
|> assert_id_from_response(comment.id)
3736
end
3837

3938
test "renders 404 when id is nonexistent", %{conn: conn} do

test/controllers/donation_goal_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ defmodule CodeCorps.DonationGoalControllerTest do
3232
conn
3333
|> request_show(donation_goal)
3434
|> json_response(200)
35-
|> Map.get("data")
36-
|> assert_result_id(donation_goal.id)
35+
|> assert_id_from_response(donation_goal.id)
3736
end
3837

3938
test "renders 404 when id is nonexistent", %{conn: conn} do

test/controllers/organization_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ defmodule CodeCorps.OrganizationControllerTest do
3333
conn
3434
|> request_show(organization)
3535
|> json_response(200)
36-
|> Map.get("data")
37-
|> assert_result_id(organization.id)
36+
|> assert_id_from_response(organization.id)
3837
end
3938

4039
test "renders 404 when id is nonexistent", %{conn: conn} do

test/controllers/project_category_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ defmodule CodeCorps.ProjectCategoryControllerTest do
3232
conn
3333
|> request_show(project_category)
3434
|> json_response(200)
35-
|> Map.get("data")
36-
|> assert_result_id(project_category.id)
35+
|> assert_id_from_response(project_category.id)
3736
end
3837

3938
test "renders 404 when id is nonexistent", %{conn: conn} do

test/controllers/project_controller_test.exs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ defmodule CodeCorps.ProjectControllerTest do
4444
conn
4545
|> request_show(project)
4646
|> json_response(200)
47-
|> Map.get("data")
48-
|> assert_result_id(project.id)
47+
|> assert_id_from_response(project.id)
4948
end
5049

5150
test "shows chosen resource retrieved by slug", %{conn: conn} do
@@ -57,8 +56,7 @@ defmodule CodeCorps.ProjectControllerTest do
5756
conn
5857
|> get(path)
5958
|> json_response(200)
60-
|> Map.get("data")
61-
|> assert_result_id(project.id)
59+
|> assert_id_from_response(project.id)
6260
end
6361

6462
test "retrieval by slug is case insensitive", %{conn: conn} do

test/controllers/project_skill_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ defmodule CodeCorps.ProjectSkillControllerTest do
3232
conn
3333
|> request_show(project_skill)
3434
|> json_response(200)
35-
|> Map.get("data")
36-
|> assert_result_id(project_skill.id)
35+
|> assert_id_from_response(project_skill.id)
3736
end
3837

3938
test "renders 404 error when id is nonexistent", %{conn: conn} do

test/controllers/project_user_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ defmodule CodeCorps.ProjectUserControllerTest do
3232
conn
3333
|> request_show(record)
3434
|> json_response(200)
35-
|> Map.get("data")
36-
|> assert_result_id(record.id)
35+
|> assert_id_from_response(record.id)
3736
end
3837

3938
test "renders 404 when id is nonexistent", %{conn: conn} do

test/controllers/role_skill_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ defmodule CodeCorps.RoleSkillControllerTest do
3030
conn
3131
|> request_show(role_skill)
3232
|> json_response(200)
33-
|> Map.get("data")
34-
|> assert_result_id(role_skill.id)
33+
|> assert_id_from_response(role_skill.id)
3534
end
3635

3736
test "renders 404", %{conn: conn} do

test/controllers/skill_controller_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ defmodule CodeCorps.SkillControllerTest do
6161
conn
6262
|> request_show(skill)
6363
|> json_response(200)
64-
|> Map.get("data")
65-
|> assert_result_id(skill.id)
64+
|> assert_id_from_response(skill.id)
6665
end
6766

6867
test "renders 404 when id is nonexistent", %{conn: conn} do

0 commit comments

Comments
 (0)