Use `response.parsed_body` for html response checks (#31750)

pull/2836/head
Matt Jankowski 2024-09-04 13:29:05 -04:00 committed by GitHub
parent fe04291af4
commit e1b5f3fc6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 10 deletions

View File

@ -48,7 +48,7 @@ RSpec.describe Admin::AccountsController do
end
def accounts_table_rows
Nokogiri::Slop(response.body).css('table.accounts-table tr')
response.parsed_body.css('table.accounts-table tr')
end
end

View File

@ -64,7 +64,7 @@ RSpec.describe Admin::ExportDomainBlocksController do
end
def batch_table_rows
Nokogiri::Slop(response.body).css('body div.batch-table__row')
response.parsed_body.css('body div.batch-table__row')
end
end

View File

@ -35,7 +35,7 @@ RSpec.describe Admin::InstancesController do
end
def instance_directory_links
Nokogiri::Slop(response.body).css('div.directory__tag a')
response.parsed_body.css('div.directory__tag a')
end
end

View File

@ -342,7 +342,7 @@ RSpec.describe Auth::RegistrationsController do
end
def username_error_text
Nokogiri::Slop(response.body).css('.user_account_username .error').text
response.parsed_body.css('.user_account_username .error').text
end
end

View File

@ -18,14 +18,16 @@ RSpec.describe 'The account show page' do
end
def head_link_icons
head_section.css('link[rel=icon]')
response
.parsed_body
.search('html head link[rel=icon]')
end
def head_meta_content(property)
head_section.meta("[@property='#{property}']")[:content]
end
def head_section
Nokogiri::Slop(response.body).html.head
response
.parsed_body
.search("html head meta[property='#{property}']")
.attr('content')
.text
end
end