Class: Webrat::FileField

Inherits:
Field
  • Object
show all
Defined in:
lib/cucumber-wordpress/webrat-patches.rb

Instance Method Summary collapse

Instance Method Details

#test_uploaded_fileObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/cucumber-wordpress/webrat-patches.rb', line 49

def test_uploaded_file
  return "" if @original_value.blank?

  case Webrat.configuration.mode
  when :rails
    if content_type
      ActionController::TestUploadedFile.new(@original_value, content_type)
    else
      ActionController::TestUploadedFile.new(@original_value)
    end
  when :rack, :merb
    Rack::Test::UploadedFile.new(@original_value, content_type)
  when :mechanize
    open(@original_value) if @original_value.present?
  end
end