Class: Webrat::FileField

Inherits:
Field show all
Defined in:
lib/webrat/core/elements/field.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from Field

#value

Attributes inherited from Element

#element

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Field

#disabled?, field_class, field_classes, #id, inherited, #initialize, #label_text, load, #name, #raise_error_if_disabled, #to_multipart_param, #unset

Methods inherited from Element

#initialize, #inspect, load, load_all, #path

Constructor Details

This class inherits a constructor from Webrat::Field

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



338
339
340
# File 'lib/webrat/core/elements/field.rb', line 338

def content_type
  @content_type
end

Class Method Details

.xpath_searchObject



334
335
336
# File 'lib/webrat/core/elements/field.rb', line 334

def self.xpath_search
  ".//input[@type = 'file']"
end

Instance Method Details

#set(value, content_type = nil) ⇒ Object



340
341
342
343
# File 'lib/webrat/core/elements/field.rb', line 340

def set(value, content_type = nil)
  super(value)
  @content_type = content_type
end

#to_paramObject



345
346
347
348
349
350
351
352
353
354
355
# File 'lib/webrat/core/elements/field.rb', line 345

def to_param
  if @value.nil?
    super
  else
    if Webrat.configuration.mode == :merb
      nil
    else
      replace_param_value(super, @value, test_uploaded_file)
    end
  end
end