Sha256: f2946496ed630277a928c1c60ae4b752c758e2a92ab3b99e74966352bf939709

Contents?: true

Size: 1.49 KB

Versions: 29

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

# NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.

Capybara::SpecHelper.spec '#html' do
  it 'should return the unmodified page body' do
    @session.visit('/')
    expect(@session.html).to include('Hello world!')
  end

  it 'should return the current state of the page', requires: [:js] do
    @session.visit('/with_js')
    sleep 1
    expect(@session.html).to include('I changed it')
    expect(@session.html).not_to include('This is text')
  end
end

Capybara::SpecHelper.spec '#source' do
  it 'should return the unmodified page source' do
    @session.visit('/')
    expect(@session.source).to include('Hello world!')
  end

  it 'should return the current state of the page', requires: [:js] do
    @session.visit('/with_js')
    sleep 1
    expect(@session.source).to include('I changed it')
    expect(@session.source).not_to include('This is text')
  end
end

Capybara::SpecHelper.spec '#body' do
  it 'should return the unmodified page source' do
    @session.visit('/')
    expect(@session.body).to include('Hello world!')
  end

  it 'should return the current state of the page', requires: [:js] do
    @session.visit('/with_js')
    sleep 1
    expect(@session.body).to include('I changed it')
    expect(@session.body).not_to include('This is text')
  end
end

Version data entries

29 entries across 23 versions & 4 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/capybara-3.40.0/lib/capybara/spec/session/html_spec.rb
capybara-3.40.0 lib/capybara/spec/session/html_spec.rb
capybara-3.39.2 lib/capybara/spec/session/html_spec.rb
capybara-3.39.1 lib/capybara/spec/session/html_spec.rb
capybara-3.39.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/spec/session/html_spec.rb
capybara-3.38.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/spec/session/html_spec.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/spec/session/html_spec.rb
capybara-3.37.1 lib/capybara/spec/session/html_spec.rb
capybara-3.37.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/capybara-3.36.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/html_spec.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/spec/session/html_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/spec/session/html_spec.rb
capybara-3.36.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/html_spec.rb