From a6fcd4fac366d5ea3723be999192f32ab2341f09 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 19 Oct 2023 20:04:08 +0300 Subject: [PATCH] Test more block attributes in show call --- .../api/user_blocks_controller_test.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/controllers/api/user_blocks_controller_test.rb b/test/controllers/api/user_blocks_controller_test.rb index c8bdc1d57aa..418ca03a1ee 100644 --- a/test/controllers/api/user_blocks_controller_test.rb +++ b/test/controllers/api/user_blocks_controller_test.rb @@ -14,11 +14,22 @@ def test_routes end def test_show - block = create(:user_block) + blocked_user = create(:user) + creator_user = create(:moderator_user) + block = create(:user_block, :user => blocked_user, :creator => creator_user, :reason => "because running tests") get api_user_block_path(:id => block) assert_response :success - assert_select "user_block[id='#{block.id}']", 1 + assert_select "osm>user_block", 1 do + assert_select ">@id", block.id.to_s + assert_select ">user", 1 + assert_select ">user>@uid", blocked_user.id.to_s + assert_select ">creator", 1 + assert_select ">creator>@uid", creator_user.id.to_s + assert_select ">revoker", 0 + assert_select ">reason", 1 + assert_select ">reason", "because running tests" + end get api_user_block_path(:id => block, :format => "json") assert_response :success