Sha256: 0dc709a675cc7cb17ddd9dd4bf87acae2a715ae442ce06243e32c65cb29fd9d2

Contents?: true

Size: 1.49 KB

Versions: 54

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

54 entries across 49 versions & 3 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/html_spec.rb
capybara-3.34.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/capybara-3.32.2/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/spec/session/html_spec.rb
capybara-3.33.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.29.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/capybara-3.32.2/lib/capybara/spec/session/html_spec.rb
capybara-3.32.2 lib/capybara/spec/session/html_spec.rb
capybara-3.32.1 lib/capybara/spec/session/html_spec.rb
capybara-3.32.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/capybara-3.31.0/lib/capybara/spec/session/html_spec.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/capybara-3.29.0/lib/capybara/spec/session/html_spec.rb
capybara-3.31.0 lib/capybara/spec/session/html_spec.rb
capybara-3.30.0 lib/capybara/spec/session/html_spec.rb
tdiary-5.1.0 vendor/bundle/gems/capybara-3.29.0/lib/capybara/spec/session/html_spec.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/capybara-3.29.0/lib/capybara/spec/session/html_spec.rb