Sha256: 7d3dfc70d1d93f719887d2cb323a58fc15f31307e9ec99c927fd1271f908f16d

Contents?: true

Size: 858 Bytes

Versions: 104

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

module Capybara
  module RSpecMatchers
    module Matchers
      class BecomeClosed
        def initialize(options)
          @options = options
        end

        def matches?(window)
          @window = window
          @wait_time = Capybara::Queries::BaseQuery.wait(@options, window.session.config.default_max_wait_time)
          timer = Capybara::Helpers.timer(expire_in: @wait_time)
          while window.exists?
            return false if timer.expired?

            sleep 0.01
          end
          true
        end

        def failure_message
          "expected #{@window.inspect} to become closed after #{@wait_time} seconds"
        end

        def failure_message_when_negated
          "expected #{@window.inspect} not to become closed after #{@wait_time} seconds"
        end
      end
    end
  end
end

Version data entries

104 entries across 91 versions & 6 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/capybara-3.40.0/lib/capybara/rspec/matchers/become_closed.rb
capybara-3.40.0 lib/capybara/rspec/matchers/become_closed.rb
capybara-3.39.2 lib/capybara/rspec/matchers/become_closed.rb
capybara-3.39.1 lib/capybara/rspec/matchers/become_closed.rb
capybara-3.39.0 lib/capybara/rspec/matchers/become_closed.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/become_closed.rb
capybara-3.38.0 lib/capybara/rspec/matchers/become_closed.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/rspec/matchers/become_closed.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/rspec/matchers/become_closed.rb
capybara-3.37.1 lib/capybara/rspec/matchers/become_closed.rb
capybara-3.37.0 lib/capybara/rspec/matchers/become_closed.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/become_closed.rb
isomorfeus-puppetmaster-0.5.7 lib/isomorfeus/puppetmaster/rspec/matchers/become_closed.rb
isomorfeus-puppetmaster-0.5.6 lib/isomorfeus/puppetmaster/rspec/matchers/become_closed.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/rspec/matchers/become_closed.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/become_closed.rb
isomorfeus-puppetmaster-0.5.5 lib/isomorfeus/puppetmaster/rspec/matchers/become_closed.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/become_closed.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/become_closed.rb
isomorfeus-puppetmaster-0.5.4 lib/isomorfeus/puppetmaster/rspec/matchers/become_closed.rb