Sha256: b53ac588145cc86e194fe3f97974e568913aa6d99511f743dc33d3d5bf93bc34

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

require 'gem_patching'

Gem.patching('webrat', '0.7.2') do
  Webrat::FileField.class_eval do
    include ActionDispatch::TestProcess

    def test_uploaded_file
      return "" if @original_value.blank?

      case Webrat.configuration.mode
      when :rails
        if content_type
          # Rails 3 does not have an ActionController::TestUploadedFile anymore
          Rack::Test::UploadedFile.new(@original_value, content_type)
        else
          Rack::Test::UploadedFile.new(@original_value)
        end
      when :rack, :merb
        Rack::Test::UploadedFile.new(@original_value, content_type)
      end
    end
  end
end if defined?(Webrat)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adva-core-0.0.6 lib/patches/webrat/upload_file.rb
adva-core-0.0.5 lib/patches/webrat/upload_file.rb
adva-core-0.0.4 lib/patches/webrat/upload_file.rb