Sha256: 60e35a419e307fb878542ca1a302ceb879304bd6474a84b073eefa3db6c274b0

Contents?: true

Size: 960 Bytes

Versions: 8

Compression:

Stored size: 960 Bytes

Contents

# 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

  if "".respond_to?(:encoding)
    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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
capybara-3.1.1 lib/capybara/spec/session/body_spec.rb
capybara-3.1.0 lib/capybara/spec/session/body_spec.rb
capybara-3.0.3 lib/capybara/spec/session/body_spec.rb
capybara-3.0.2 lib/capybara/spec/session/body_spec.rb
capybara-3.0.1 lib/capybara/spec/session/body_spec.rb
capybara-3.0.0 lib/capybara/spec/session/body_spec.rb
capybara-3.0.0.rc2 lib/capybara/spec/session/body_spec.rb
capybara-3.0.0.rc1 lib/capybara/spec/session/body_spec.rb