Sha256: faa0ae8a6356c22d3c49f302fe91185e9d5a386d8657526f59e6457eac7c0089

Contents?: true

Size: 900 Bytes

Versions: 97

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true

Capybara::SpecHelper.spec '#accept_confirm', requires: [:modals] do
  before do
    @session.visit('/with_js')
  end

  it 'should accept the confirm' do
    @session.accept_confirm do
      @session.click_link('Open confirm')
    end
    expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='true']")
  end

  it 'should return the message presented' do
    message = @session.accept_confirm do
      @session.click_link('Open confirm')
    end
    expect(message).to eq('Confirm opened')
  end

  it 'should work with nested modals' do
    expect do
      @session.dismiss_confirm 'Are you really sure?' do
        @session.accept_confirm 'Are you sure?' do
          @session.click_link('Open check twice')
        end
      end
    end.not_to raise_error
    expect(@session).to have_xpath("//a[@id='open-twice' and @confirmed='false']")
  end
end

Version data entries

97 entries across 83 versions & 5 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/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/accept_confirm_spec.rb
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/accept_confirm_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/accept_confirm_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/accept_confirm_spec.rb
capybara-3.35.3 lib/capybara/spec/session/accept_confirm_spec.rb
capybara-3.35.2 lib/capybara/spec/session/accept_confirm_spec.rb
capybara-3.35.1 lib/capybara/spec/session/accept_confirm_spec.rb
capybara-3.35.0 lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/accept_confirm_spec.rb
capybara-3.34.0 lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/capybara-3.32.2/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/spec/session/accept_confirm_spec.rb
capybara-3.33.0 lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.29.0/lib/capybara/spec/session/accept_confirm_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/capybara-3.32.2/lib/capybara/spec/session/accept_confirm_spec.rb