aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | Remove superfluous testGeorge Claghorn2018-08-191-10/+0
|/ | | | This test no longer covers the behavior of ActiveStorage::PurgeJob. Attached blobs are ignored by ActiveStorage::Blob#purge as of 934fccd, which includes an equivalent model test.
* Improve ActiveStorage service adapter error handlingJoel Taylor2018-08-061-0/+6
|
* Fix uploading Tempfiles to Azure StorageGeorge Claghorn2018-08-031-0/+17
| | | | Closes #32530.
* Ignore ActiveRecord::InvalidForeignKey in ActiveStorage::Blob#purgeJasper Martin2018-07-263-2/+93
| | | Do nothing instead of raising an error when it’s called on an attached blob.
* Merge pull request #33229 from ↵Matthew Draper2018-07-251-1/+1
|\ | | | | | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * Recommend use of rails over bin/railsAlberto Almagro2018-07-061-1/+1
| | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | Discard ActiveStorage::PurgeJobs on ActiveRecord::InvalidForeignKeyGeorge Claghorn2018-07-201-0/+10
| |
* | Test that ActiveStorage::Blob#purge fails when attachments existGeorge Claghorn2018-07-201-0/+8
| |
* | Add a foreign-key constraint to the attachments table for blobsGeorge Claghorn2018-07-192-2/+2
| |
* | Remove unnecessary tapGeorge Claghorn2018-07-171-10/+8
| |
* | Fix replacing many attachments via assign and attachGeorge Claghorn2018-07-171-0/+36
| |
* | Correct test nameGeorge Claghorn2018-07-161-1/+1
| |
* | Fix that successive ActiveStorage::Attached::Many#attach calls would ↵George Claghorn2018-07-161-26/+11
| | | | | | | | overwrite previous attachments
* | Test removing attachments via #attachGeorge Claghorn2018-07-162-12/+59
| |
* | Restore inadvertently-removed fallbackGeorge Claghorn2018-07-151-0/+6
| |
* | Support HTTP Range downloads from diskGeorge Claghorn2018-07-151-2/+11
| | | | | | | | Closes #32193.
* | Clear attachment changes on reloadGeorge Claghorn2018-07-132-0/+16
| |
* | Implement ActiveStorage::Attached::{One,Many}#attach in terms of changesGeorge Claghorn2018-07-132-29/+153
| |
* | Fix that detaching could purgeGeorge Claghorn2018-07-132-0/+32
| |
* | Fix analyzing new blobs from uploaded files on attachGeorge Claghorn2018-07-132-0/+116
| |
* | Discard ActiveStorage::PurgeJobs for missing blobsGeorge Claghorn2018-07-111-0/+27
| |
* | Raise an ArgumentError instead of a RuntimeErrorGeorge Claghorn2018-07-082-2/+2
| |
* | Store newly-uploaded files on save rather than assignmentGeorge Claghorn2018-07-077-531/+680
| |
* | Fix that models can clobber each others' attachment reflectionsGeorge Claghorn2018-07-072-14/+23
|/ | | | | | | | | | | | | | Consider the following model definitions: class User < ApplicationRecord has_one_attached :avatar end class Group < ApplicationRecord has_one_attached :avatar end If you attempt to reflect on the User model's avatar attachment via User.reflect_on_attachment, you could receive a reflection for the Group model's avatar attachment. Fix this by ensuring that each model class uses its own Hash object to track attachment reflections.
* Generate a new key for each service testGeorge Claghorn2018-06-256-20/+20
| | | | Sidestep Google Cloud Storage's restrictive per-object rate limit.
* Permit configuring the default service URL expiryGeorge Claghorn2018-06-211-3/+3
|
* Fix "warning: Net::HTTPResponse#header is obsolete"yuuji.yaginuma2018-06-171-1/+1
| | | | Ref: https://github.com/ruby/ruby/blob/cc77a811298bd7ab1c422f7f999b93c858327da9/lib/net/http/response.rb#L138-L155
* Refactor activestorage/test/models/attached_test.rbbogdanvlviv2018-06-071-19/+21
| | | | | | | | | | | Don't include `ActiveJob::TestHelper` since there is no test that uses it. Ensure removing of overridden User's methods. Related to https://github.com/rails/rails/pull/33085#issuecomment-395548563 Module#remove_method is private in Ruby 2.4. Related to fd0bd1bf682622f064ac437ceee4e1b2a6b6d3b9
* Merge pull request #33018 from kddeisz/defined-attachmentsRafael França2018-06-011-0/+29
|\ | | | | ActiveStorage reflection
| * Move ActiveStorage reflection logic entirely into ActiveStorageKevin Deisz2018-05-311-2/+2
| |
| * Reflection for attachmentsKevin Deisz2018-05-301-0/+29
| | | | | | | | Add the ability to reflect on the attachments that have been defined using ActiveRecord::Reflection.
* | Remove errant debugger callGeorge Claghorn2018-05-301-1/+0
| |
* | Include blob ID in tempfile name for debugging convenienceGeorge Claghorn2018-05-301-5/+9
|/
* Verify integrity after chunked downloadGeorge Claghorn2018-05-281-1/+11
|
* Change video preview format from PNG to JPGJavan Makhmali2018-05-232-4/+5
|
* Merge pull request #32144 from kazu9su/masterGeorge Claghorn2018-05-221-0/+4
|\ | | | | Add ActiveStorage::Service::DiskService#url_for_direct_upload test
| * Add ActiveStorage::Service::DiskService#url_for_direct_upload testtommy2018-03-011-0/+4
| |
* | Disable variant options when false or nil presentJacob Smith2018-05-211-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In response to https://github.com/rails/rails/issues/32917 In the current implementation, ActiveStorage passes all options to the underlying processor, including when a key has a value of false. For example, passing: ``` avatar.variant(resize: "100x100", monochrome: false, flip: "-90") ``` will return a monochrome image (or an error, pending on ImageMagick configuration) because it passes `-monochrome false` to the command (but the command line does not allow disabling flags this way, as usually a user would omit the flag entirely to disable that feature). This fix only passes those keys forward to the underlying processor if the value responds to `present?`. In practice, this means that `false` or `nil` will be filtered out before going to the processor. One possible use case would be for a user to be able to apply different filters to an avatar. The code might look something like: ``` variant_options = { monochrome: params[:monochrome], resize: params[:resize] } avatar.variant(*variant_options) ``` Obviously some sanitization may be beneficial in a real-world scenario, but this type of configuration object could be used in many other places as well. - Add removing falsy values from varaints to changelog - The entirety of #image_processing_transformation inject block was wrapped in `list.tap` to guard against the default `nil` being returned if no conditional was called. - add test for explicitly true variant options
* | Permit opening a blob in a custom tempdirGeorge Claghorn2018-05-171-0/+12
| |
* | Generate getter and setter methods in mixinJosh Susser2018-05-171-0/+54
| | | | | | | | | | | | | | | | | | | | | | Generated attachment getter and setter methods are created within the model's `GeneratedAssociationMethods` module to allow overriding and composition using `super`. Includes tests for new functionality. Co-authored-by: Josh Susser <josh@hasmanythrough.com> Co-authored-by: Jamon Douglas <terrildouglas@gmail.com>
* | Add ActiveStorage::Blob#openGeorge Claghorn2018-05-161-0/+9
| | | | | | | | [David Robertson & George Claghorn]
* | Add option to ActiveStorage::Blob to set extract_content_type_from_ioRyan Davidson2018-05-082-2/+12
| | | | | | | | | | | | | | 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.
* | Assert correct response bodyGeorge Claghorn2018-05-031-4/+6
| |
* | Support streaming downloads from Google Cloud StorageGeorge Claghorn2018-05-011-5/+13
| |
* | Stream blobs from disk in 5 MB chunksGeorge Claghorn2018-04-291-3/+3
| | | | | | | | Match other services, which all use a 5 MB chunk size.
* | Merge pull request #31956 from fatkodima/has_attached-presence-validationEileen M. Uchitelle2018-04-271-0/+30
|\ \ | | | | | | has_(one/many)_attached presence validation
| * | has_(one/many)_attached presence validationfatkodima2018-02-111-0/+30
| | |
* | | Move #extract_metadata_from to ActiveStorage's TestHelperRicardo Díaz2018-04-253-10/+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.
* | | Show ImageProcessing macros in a dedicated exampleJanko Marohnić2018-04-231-3/+13
| | |
* | | Rename ActiveStorage.processor to .variant_processorJanko Marohnić2018-04-221-4/+4
| | |