Skip to content

Commit

Permalink
Test more block attributes in show call
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 20, 2024
1 parent 017f7da commit ae9dfa7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/controllers/api/user_blocks_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(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(block, :format => "json")
assert_response :success
Expand Down

0 comments on commit ae9dfa7

Please sign in to comment.