Sha256: e9c04dde9c139d0bca0bc5b743e503f97825ee1c78e875b3e52646de49fb5d64

Contents?: true

Size: 942 Bytes

Versions: 3

Compression:

Stored size: 942 Bytes

Contents

# webrat/integrations/rails.rb requires 'action_controller/integration' which
# does not exist in rails 3 any more. so we gotta replace the whole file.

require 'gem_patching'

Gem.patching('webrat', '0.7.2') do
  require "action_controller"
  # require "action_controller/integration"
  require 'action_dispatch/testing/integration'

  module ActionController #:nodoc:
    IntegrationTest.class_eval do
      include Webrat::Methods
      include Webrat::Matchers

      # The Rails version of within supports passing in a model and Webrat
      # will apply a scope based on Rails' dom_id for that model.
      #
      # Example:
      #   within User.last do
      #     click_link "Delete"
      #   end
      def within(selector_or_object, &block)
        if selector_or_object.is_a?(String)
          super
        else
          super('#' + RecordIdentifier.dom_id(selector_or_object), &block)
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adva-core-0.0.6 lib/webrat/integrations/rails.rb
adva-core-0.0.5 lib/webrat/integrations/rails.rb
adva-core-0.0.4 lib/webrat/integrations/rails.rb