aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/test_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add option to ActiveStorage::Blob to set extract_content_type_from_ioRyan Davidson2018-05-081-2/+2
| | | | | | | This adds a boolean argument called identify to ActiveStorage::Blob methods #create_after_upload, #build_after_upload and #upload. It allows a user to bypass the automatic content_type inference from the io.
* Move #extract_metadata_from to ActiveStorage's TestHelperRicardo Díaz2018-04-251-0/+4
| | | | | | ImageAnalyzerTest and VideoAnalyzerTest are defining the same helper, since both use `#create_file_blob` that is defined in TestHelper, it makes sense to move `#extract_metadata_from` to that side.
* Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend.
* Use a current model to provide the host for service urlsAndrew White2018-04-061-0/+8
| | | | | | | Trying to pass the current request down to the service so that it can create full urls instead of paths makes the API messy so use a model based on ActiveSupport::CurrentAttributes to provide the current host to services that need it (primarily the disk service).
* Flip the order of the after_create callbacksDwight Watson2018-03-271-0/+10
| | | | | | | | | | Addresses rails/rails#32247 Add test that checks identify and analyze work in correct order Break out direct upload test helper Review changes for direct-upload test helper
* Fix purging dependent blobs when attachments aren't loadedGeorge Claghorn2018-03-051-0/+2
|
* Delete dependent attachments with recordGeorge Claghorn2018-03-051-0/+1
| | | | [Matt Jones & George Claghorn]
* Generate root-relative paths in Active Storage disk service URL methodsGeorge Claghorn2018-03-051-3/+0
| | | | Fixes #32129.
* Provide a sensible default hostGeorge Claghorn2018-01-161-1/+1
|
* Extract content types from blob dataGeorge Claghorn2018-01-151-1/+4
|
* Fix direct uploads to local serviceGeorge Claghorn2017-11-201-0/+1
| | | | | | | | Disable CSRF protection for ActiveStorage::DiskController#update. The local disk service is intended to imitate a third-party service like S3 or GCS, so we don't care where direct uploads originate: they’re authorized by signed tokens. Closes #30290. [Shinichi Maeshima & George Claghorn]
* Preserve existing metadata when analyzing a blobGeorge Claghorn2017-11-131-2/+2
| | | | Closes #31138.
* Extract metadata from images and videosGeorge Claghorn2017-10-221-4/+2
|
* Use `require_relative` instead of `require` with full path in activestorage/bogdanvlviv2017-10-131-1/+1
| | | | Related to #29417
* Define path with __dir__ in activestorage/bogdanvlviv2017-10-131-2/+2
| | | | Related to #29176
* Preview PDFs and videosGeorge Claghorn2017-09-281-3/+4
|
* Use nil Logger for testsJon Moss2017-08-171-1/+1
| | | | | | | | | | | | | | | | Makes tests much more quietly, as opposed to the enormous amount of logging that appears right now. This setting is used in AJ, as well as other frameworks. Output from test run: ``` ......................................................... Finished in 3.003355s, 18.9788 runs/s, 45.2827 assertions/s. 57 runs, 136 assertions, 0 failures, 0 errors, 0 skips ```
* Use frozen string literal in Active StorageKoichi ITO2017-08-121-0/+2
|
* Merge pull request #30113 from dixpac/remove_unecessary_require_in_test_helperRafael França2017-08-111-2/+0
|\ | | | | ActiveStorage: Remove unnecessary require in test_helper
| * Remove unecessary require in test_helperdixpac2017-08-091-2/+0
| |
* | Run Active Storage tests in CI (#30144)George Claghorn2017-08-101-2/+11
|/
* Filter out Minitest backtrace.dixpac2017-08-071-0/+4
| | | | | Filter out Minitest backtrace while allowing backtrace from other libraries to be shown.
* Let ActiveStorage tests pass only for Diskclaudiob2017-08-011-1/+3
| | | | | | | | | | | | | | | | If you have a "service/configurations.yml" file, but every single line is commented out, then an error occurs when running tests: ``` git:active-storage-import~/code/rails/activestorage$ rake ~/code/rails/activestorage/test/test_helper.rb:17:in `<top (required)>': undefined method `deep_symbolize_keys' for false:FalseClass (NoMethodError) from ~/code/rails/activestorage/test/controllers/direct_uploads_controller_test.rb:1:in `require' ``` The reason is that `YAML.load(..an empty file content..)` simply returns `false`, and not `{}`. This PR fixes this behavior so tests can also run when no remote service is available.
* Setup travis to be able to run CI tests against S3David Heinemeier Hansson2017-07-311-1/+1
|
* Add 'activestorage/' from commit '3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58'Rafael Mendonça França2017-07-311-0/+54
git-subtree-dir: activestorage git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6 git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58