Undefined method 'delegate' for capybara :: dsl :: module

I have a capybara monkey patch for working with jquery-ui that works well on Ubuntu ... although when I go to windows I get the following error (all the dependency stones were installed successfully):

Undefined method 'delegate' for capybara :: dsl :: module

The line of code that occurs is as follows:

module Capybara::DSL
  delegate :datepick, :datetimepick, :timepick, to: :page
end

Any ideas on what this might be? a little lost why this error is shown simply by switching the OS ...

+4
source share
1 answer

In standard ruby ​​deletion is handled by the module Forwadable. You need requireand then extend forwardableaccess the following methods:

require 'forwardable'
module Capybara::DSL
  extend Forwardable
  #notice syntax is accessor, *methods
  def_delegators :page, :datepick, :datetimepick, :timepick
end

, , Module Class. , :

require 'active_support/core_ext/module'
module Capybara::DSL
  #active_support syntax allows a to: element in the hash to act as the accessor
  delegate :datepick, :datetimepick, :timepick, to: :page
end
+5

All Articles