Sha256: e6370e6da29a9ab6e9b178e800c9bc8ffc5117888ba729ca2544e87e85f05088

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 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 '#refresh' do
  it 'reload the page' do
    @session.visit('/form')
    expect(@session).to have_select('form_locale', selected: 'English')
    @session.select('Swedish', from: 'form_locale')
    expect(@session).to have_select('form_locale', selected: 'Swedish')
    @session.refresh
    expect(@session).to have_select('form_locale', selected: 'English')
  end

  it 'raises any errors caught inside the server', requires: [:server] do
    quietly { @session.visit('/error') }
    expect do
      @session.refresh
    end.to raise_error(TestApp::TestAppError)
  end

  it 'it reposts' do
    @session.visit('/form')
    @session.select('Sweden', from: 'form_region')
    @session.click_button('awesome')
    sleep 2
    expect do
      @session.refresh
      sleep 2
    end.to change { extract_results(@session)['post_count'] }.by(1)
  end
end

Version data entries

6 entries across 4 versions & 2 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/refresh_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/refresh_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/refresh_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/refresh_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/refresh_spec.rb
capybara-3.34.0 lib/capybara/spec/session/refresh_spec.rb