Sha256: 9d63f78a0879a9ffbed3e4fee29794d51b4b8b5b4b252feb7103107e4a6beefe

Contents?: true

Size: 928 Bytes

Versions: 2

Compression:

Stored size: 928 Bytes

Contents

require 'capybara'

module CapybaraExtensions
  def self.extension_methods
    (CapybaraExtensions::Finders.instance_methods + CapybaraExtensions::Matchers.instance_methods - Object.instance_methods).uniq
  end
end

require 'capybara-extensions/finders'
require 'capybara-extensions/matchers'

module Capybara::DSL
  CapybaraExtensions.extension_methods.each do |method|
    define_method method do |*args, &block|
      page.send method, *args, &block
    end
  end
end

class Capybara::Session
  CapybaraExtensions.extension_methods.each do |method|
    define_method method do |*args, &block|
      current_scope.send method, *args, &block
    end
  end
end

Capybara::Node::Base.send(:include, CapybaraExtensions::Finders)
Capybara::Node::Base.send(:include, CapybaraExtensions::Matchers)
Capybara::Node::Simple.send(:include, CapybaraExtensions::Matchers)
Capybara::Node::Simple.send(:include, CapybaraExtensions::Finders)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capybara-extensions-0.4.1 lib/capybara-extensions.rb
capybara-extensions-0.4.0 lib/capybara-extensions.rb