Sha256: 768535e59a38bb529aedc61b97c2a8088a0fe394e0ff1e33ae782a831c223bd3

Contents?: true

Size: 1021 Bytes

Versions: 19

Compression:

Stored size: 1021 Bytes

Contents

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

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

  module DSL
    class <<self
      remove_method :included

      def included(base)
        warn "including Capybara::DSL in the global scope is not recommended!" if base == Object

        if defined?(::RSpec::Matchers) && base.include?(::RSpec::Matchers)
          base.send(:include, ::Capybara::RSpecMatcherProxies)
        end

        super
      end
    end
  end
end

if defined?(::RSpec::Matchers)
  module  ::RSpec::Matchers
    def self.included(base)
      base.send(:include, ::Capybara::RSpecMatcherProxies) if base.include?(::Capybara::DSL)
      super
    end
  end
end

Version data entries

19 entries across 17 versions & 2 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/capybara-2.18.0/lib/capybara/rspec/matcher_proxies.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/capybara-2.18.0/lib/capybara/rspec/matcher_proxies.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/capybara-2.16.1/lib/capybara/rspec/matcher_proxies.rb
capybara-2.18.0 lib/capybara/rspec/matcher_proxies.rb
capybara-2.17.0 lib/capybara/rspec/matcher_proxies.rb
tdiary-5.0.7 vendor/bundle/gems/capybara-2.16.1/lib/capybara/rspec/matcher_proxies.rb
capybara-2.16.1 lib/capybara/rspec/matcher_proxies.rb
capybara-2.16.0 lib/capybara/rspec/matcher_proxies.rb
capybara-2.15.4 lib/capybara/rspec/matcher_proxies.rb
capybara-2.15.3 lib/capybara/rspec/matcher_proxies.rb
capybara-2.15.2 lib/capybara/rspec/matcher_proxies.rb
tdiary-5.0.6 vendor/bundle/gems/capybara-2.15.1/lib/capybara/rspec/matcher_proxies.rb
capybara-2.15.1 lib/capybara/rspec/matcher_proxies.rb
capybara-2.15.0 lib/capybara/rspec/matcher_proxies.rb
tdiary-5.0.5 vendor/bundle/gems/capybara-2.14.3/lib/capybara/rspec/matcher_proxies.rb
capybara-2.14.4 lib/capybara/rspec/matcher_proxies.rb
capybara-2.14.3 lib/capybara/rspec/matcher_proxies.rb
capybara-2.14.2 lib/capybara/rspec/matcher_proxies.rb
capybara-2.14.1 lib/capybara/rspec/matcher_proxies.rb