Sha256: b32994ee8cbcbf9f1fa56edada2c80259c9faaaf55601f832b8dd3b9a3961f5b

Contents?: true

Size: 1.26 KB

Versions: 27

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module Capybara
  module RSpecMatcherProxies
    def all(*args, &block)
      if defined?(::RSpec::Matchers::BuiltIn::All) && args.first.respond_to?(:matches?)
        ::RSpec::Matchers::BuiltIn::All.new(*args)
      else
        find_all(*args, &block)
      end
    end

    def within(*args)
      if block_given?
        within_element(*args, &Proc.new)
      else
        be_within(*args)
      end
    end
  end

  module DSLRSpecProxyInstaller
    module ClassMethods
      def included(base)
        if defined?(::RSpec::Matchers)
          base.include(::Capybara::RSpecMatcherProxies) if base.include?(::RSpec::Matchers)
        end
        super
      end
    end

    def self.prepended(base)
      class <<base
        prepend ClassMethods
      end
    end
  end

  module RSpecMatcherProxyInstaller
    module ClassMethods
      def included(base)
        base.include(::Capybara::RSpecMatcherProxies) if base.include?(::Capybara::DSL)
        super
      end
    end

    def self.prepended(base)
      class <<base
        prepend ClassMethods
      end
    end
  end

  DSL.prepend ::Capybara::DSLRSpecProxyInstaller
end

if defined?(::RSpec::Matchers)
  module ::RSpec::Matchers
    prepend ::Capybara::RSpecMatcherProxyInstaller
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
tdiary-5.0.11 vendor/bundle/gems/capybara-3.6.0/lib/capybara/rspec/matcher_proxies.rb
capybara-3.9.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.8.2 lib/capybara/rspec/matcher_proxies.rb
capybara-3.8.1 lib/capybara/rspec/matcher_proxies.rb
capybara-3.8.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.7.2 lib/capybara/rspec/matcher_proxies.rb
capybara-3.7.1 lib/capybara/rspec/matcher_proxies.rb
capybara-3.7.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.6.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.5.1 lib/capybara/rspec/matcher_proxies.rb
capybara-3.5.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.4.2 lib/capybara/rspec/matcher_proxies.rb
capybara-3.4.1 lib/capybara/rspec/matcher_proxies.rb
capybara-3.4.0 lib/capybara/rspec/matcher_proxies.rb
tdiary-5.0.9 vendor/bundle/gems/capybara-3.2.1/lib/capybara/rspec/matcher_proxies.rb
capybara-3.3.1 lib/capybara/rspec/matcher_proxies.rb
capybara-3.3.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.2.1 lib/capybara/rspec/matcher_proxies.rb
capybara-3.2.0 lib/capybara/rspec/matcher_proxies.rb
capybara-3.1.1 lib/capybara/rspec/matcher_proxies.rb