mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Clarify example of the test [ci skip]
ActionDispatch::TestProcess::FixtureFile
This commit is contained in:
parent
519d09cb99
commit
f54060916f
1 changed files with 2 additions and 2 deletions
|
@ -8,12 +8,12 @@ module ActionDispatch
|
|||
module FixtureFile
|
||||
# Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.fixture_path, path), type)</tt>:
|
||||
#
|
||||
# post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png')
|
||||
# post :change_avatar, params: { avatar: fixture_file_upload('files/spongebob.png', 'image/png') }
|
||||
#
|
||||
# To upload binary files on Windows, pass <tt>:binary</tt> as the last parameter.
|
||||
# This will not affect other platforms:
|
||||
#
|
||||
# post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png', :binary)
|
||||
# post :change_avatar, params: { avatar: fixture_file_upload('files/spongebob.png', 'image/png', :binary) }
|
||||
def fixture_file_upload(path, mime_type = nil, binary = false)
|
||||
if self.class.respond_to?(:fixture_path) && self.class.fixture_path &&
|
||||
!File.exist?(path)
|
||||
|
|
Loading…
Reference in a new issue