HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/rubygems-integration/all/gems/capybara-3.36.0/lib/capybara/spec/session/body_spec.rb
# frozen_string_literal: true

Capybara::SpecHelper.spec '#body' do
  it 'should return the unmodified page body' do
    @session.visit('/')
    expect(@session).to have_content('Hello world!') # wait for content to appear if visit is async
    expect(@session.body).to include('Hello world!')
  end

  context 'encoding of response between ascii and utf8' do
    it 'should be valid with html entities' do
      @session.visit('/with_html_entities')
      expect(@session).to have_content('Encoding') # wait for content to appear if visit is async
      expect { @session.body.encode!('UTF-8') }.not_to raise_error
    end

    it 'should be valid without html entities' do
      @session.visit('/with_html')
      expect(@session).to have_content('This is a test') # wait for content to appear if visit is async
      expect { @session.body.encode!('UTF-8') }.not_to raise_error
    end
  end
end