updated tests

This commit is contained in:
mmeest 2025-06-26 11:34:50 +03:00
parent db98213818
commit ffec4fd403

View file

@ -28,25 +28,11 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
def test_shows_new_form
get new_admin_zone_path
assert_response :success
unless response.body.include?('<form')
puts "[DEBUG] 'form' not found in response body for new_admin_zone_path"
puts response.body
end
assert_includes response.body, '<form', "'form' element not found"
end
def test_shows_index
get admin_zones_path
assert_response :success
unless response.body.include?('<table')
puts "[DEBUG] 'table' not found in response body for admin_zones_path"
puts response.body
end
assert_includes response.body, '<table', "'table' element not found"
end
def test_creates_zone_successfully
@ -69,14 +55,6 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
assert_redirected_to admin_zones_url
follow_redirect!
assert_response :success
# If the table is not found in response body, print the response body
unless response.body.include?('<table')
puts "[DEBUG] 'table' not found after redirect following zone creation"
puts response.body
end
assert_includes response.body, '<table', "'table' element not found after zone cration"
end
def test_fails_to_create_zone_with_invalid_data
@ -89,21 +67,12 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
}
assert_response :success
# If the form is not found in response body, print the response body
unless response.body.include?('<form')
puts "[DEBUG] 'form' not found in response body for edit_admin_zone_path"
puts response.body
end
assert_includes response.body, '<form', "'form' element not found"
end
end
def test_shows_edit_form
get edit_admin_zone_path(@zone)
assert_response :success
assert_includes response.body, '<form', "'form' element not found in edit form"
end
def test_fails_to_update_zone_with_invalid_data
@ -111,12 +80,6 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
assert_response :success
# If the form is not found in response body, print the response body
unless response.body.include?('<form')
puts "[DEBUG] 'form' not found in response body after invalid update"
puts response.body
end
assert_includes response.body, '<form', "'form' element not found after invalid update"
@zone.reload
@ -139,5 +102,9 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
}
assert_redirected_to admin_zones_url
follow_redirect!
assert_response :success
assert_includes response.body, 'Zone has been created'
end
end