DEV: Assert for response status in tests.

This commit is contained in:
Guo Xiang Tan
2020-08-11 13:53:11 +08:00
parent b950b3fb3f
commit e64e6351bd

View File

@@ -1771,6 +1771,8 @@ describe GroupsController do
it "does not return categories the user cannot see" do it "does not return categories the user cannot see" do
get "/groups/#{group.name}/permissions.json" get "/groups/#{group.name}/permissions.json"
expect(response.status).to eq(200)
expect(response.parsed_body).to eq([]) expect(response.parsed_body).to eq([])
end end
@@ -1778,6 +1780,8 @@ describe GroupsController do
group.add(other_user) group.add(other_user)
get "/groups/#{group.name}/permissions.json" get "/groups/#{group.name}/permissions.json"
expect(response.status).to eq(200)
expect(response.parsed_body.count).to eq(1) expect(response.parsed_body.count).to eq(1)
expect(response.parsed_body.first["category"]["id"]).to eq(category.id) expect(response.parsed_body.first["category"]["id"]).to eq(category.id)
end end
@@ -1793,6 +1797,9 @@ describe GroupsController do
end end
get "/groups/#{group.name}/permissions.json" get "/groups/#{group.name}/permissions.json"
expect(response.status).to eq(200)
expect(response.parsed_body.map { |permission| permission["category"]["name"] }).to eq( expect(response.parsed_body.map { |permission| permission["category"]["name"] }).to eq(
["Abc", "Hello", "New Cat", "Three"] ["Abc", "Hello", "New Cat", "Three"]
) )