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
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 7 additions and 0 deletions

View File

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