Class: Cybertrain::Test::Upload
- Inherits:
-
Object
- Object
- Cybertrain::Test::Upload
- Defined in:
- cybertrain/test/client.rb
Overview
One file for Client#post_multipart: the name of its form field, the
filename and content type a browser would send, and its bytes.
As a value in an integration test’s params: (what
ActionDispatch::IntegrationTest#fixture_file_upload answers) its key
there names the field, so field may be "":
Instance Attribute Summary collapse
-
#content_type ⇒ String
readonly
The declared Content-Type of the part.
-
#data ⇒ String
readonly
The file’s bytes (binary).
-
#field ⇒ String
readonly
The form field name, as in
post[cover]. -
#filename ⇒ String
readonly
The filename the browser reports.
Instance Method Summary collapse
-
#initialize(field, filename, content_type, data) ⇒ Upload
constructor
A new instance of Upload.
Constructor Details
#initialize(field, filename, content_type, data) ⇒ Upload
Returns a new instance of Upload.
45 46 47 48 49 50 |
# File 'cybertrain/test/client.rb', line 45 def initialize(field, filename, content_type, data) @field = field @filename = filename @content_type = content_type @data = data end |
Instance Attribute Details
#content_type ⇒ String (readonly)
Returns the declared Content-Type of the part.
34 35 36 |
# File 'cybertrain/test/client.rb', line 34 def content_type @content_type end |
#data ⇒ String (readonly)
Returns the file’s bytes (binary).
38 39 40 |
# File 'cybertrain/test/client.rb', line 38 def data @data end |
#field ⇒ String (readonly)
Returns the form field name, as in post[cover].
26 27 28 |
# File 'cybertrain/test/client.rb', line 26 def field @field end |
#filename ⇒ String (readonly)
Returns the filename the browser reports.
30 31 32 |
# File 'cybertrain/test/client.rb', line 30 def filename @filename end |