1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add test for config.active_storage.routes_prefix

Follow up #33883.
This commit is contained in:
yuuji.yaginuma 2018-09-15 10:22:04 +09:00
parent 65bf046fd1
commit 70b5a7594e

View file

@ -2053,6 +2053,24 @@ module ApplicationTests
assert_equal [ "password", "credit_card_number" ].to_set, ActiveRecord::Base.filter_attributes
end
test "ActiveStorage.routes_prefix can be configured via config.active_storage.routes_prefix" do
app_file "config/environments/development.rb", <<-RUBY
Rails.application.configure do
config.active_storage.routes_prefix = '/files'
end
RUBY
output = rails("routes", "-g", "active_storage")
assert_equal <<~MESSAGE, output
Prefix Verb URI Pattern Controller#Action
rails_service_blob GET /files/blobs/:signed_id/*filename(.:format) active_storage/blobs#show
rails_blob_representation GET /files/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show
rails_disk_service GET /files/disk/:encoded_key/*filename(.:format) active_storage/disk#show
update_rails_disk_service PUT /files/disk/:encoded_token(.:format) active_storage/disk#update
rails_direct_uploads POST /files/direct_uploads(.:format) active_storage/direct_uploads#create
MESSAGE
end
private
def force_lazy_load_hooks
yield # Tasty clarifying sugar, homie! We only need to reference a constant to load it.