-
Notifications
You must be signed in to change notification settings - Fork 60
Conversation
test/test_helper.rb
Outdated
require "yaml" | ||
SERVICE_CONFIGURATIONS = begin | ||
YAML.load_file(File.expand_path("../service/configurations.yml", __FILE__)).deep_symbolize_keys | ||
YAML.load_file(File.expand_path("../dummy/config/storage_services.yml", __FILE__)).deep_symbolize_keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the configurations inside the dummy, otherwise dummy app will fail on the boot. Also, because of this current Travis tests will fail
I'd welcome slimming this down. There are a ton of files that aren't relevant. But if you could otherwise bring in line with master, we can merge. Definitely would like to switch to integration tests. |
872b3bf
to
e0cd338
Compare
assert_equal "inline; filename=\"#{@blob.filename}\"", @response.headers["Content-Disposition"] | ||
get rails_disk_blob_url( | ||
filename: "hello.txt", | ||
content_type: @blob.content_type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plan is to pass it in to the services, since they don't store it, and the blob has it.
@@ -35,6 +35,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase | |||
|
|||
private | |||
def expected_url_for(blob, disposition: :inline) | |||
"/rails/active_storage/disk/#{ActiveStorage.verifier.generate(blob.key, expires_in: 5.minutes, purpose: :blob_key)}/#{blob.filename}?disposition=#{disposition}&content_type=#{blob.content_type}" | |||
query_string = { content_type: blob.content_type, disposition: disposition }.to_param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails encodes the url so I'd to encode the query_string in order to match it sucessfully
@@ -6,7 +6,7 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase | |||
include ActiveStorage::Service::SharedServiceTests | |||
|
|||
test "url generation" do | |||
assert_match /rails\/active_storage\/disk\/.*\/avatar\.png\?disposition=inline/, | |||
assert_match /rails\/active_storage\/disk\/.*\/avatar\.png\?.+disposition=inline/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed a regex a bit because of the url encoding
@dhh I rebase it from the latest. Commit is a bit big(sorry) so I've added few comments on what I've changed from the first PR. In the next commits/days I will try to slim this down |
@dhh I slimmed this quiet a bit (maybe too much) by removing all rails components we are not using at the moment. There is one more approach I've tried and that is to slim all the way to the smallest app possible, take a look commit and here small app What approach do you think is better ? |
assert_equal "text/plain", @response.headers["Content-Type"] | ||
end | ||
|
||
test "sending blob as attachment" do | ||
get :show, params: { filename: @blob.filename, encoded_key: ActiveStorage.verifier.generate(@blob.key, expires_in: 5.minutes, purpose: :blob_key), disposition: :attachment } | ||
assert_equal "attachment; filename=\"#{@blob.filename}\"", @response.headers["Content-Disposition"] | ||
get rails_disk_blob_url( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminds me that now this should be rails_disk_service_url
since the DiskController no longer deals with blobs, but only with keys.
I think it's good with the smallest possible app. We're basically just setting all this stuff up to be able to use the engine initialization and integration tests properly. |
(Needs some rebasing after George merged the direct upload feature for the disk controller). |
b96f372
to
51c14ab
Compare
@dhh I've rebased and added small dummy app |
Won't we just need to add back Action View and Sprockets when the direct upload JS arrives and has to be integration/system tested? |
@kaspth yes we would! That was my initial approach just to remove action cable and action mailer and leave other components in there (for the future). But, there were was concerned with the size of the dummy so I just created it as small as "possible", to cover current use. The full dummy app would be most flexible/easy for the future use of testing. |
Would probably be good to get AV and Sprockets back in, yeah, because
@javan is just about ready with his direct upload JS PR.
Thanks for working on this, Dino!
…On Wed, Jul 26, 2017 at 12:48 PM, Dino Maric ***@***.***> wrote:
@kaspth <https://github.com/kaspth> yes we would! That was my initial
approach just to remove action cable and action mailer and leave other
components in there (for the future). But, there were was concerned with
the size of the dummy so I just created it as small as "possible", to cover
current use.
The full dummy app would be most flexible/easy for the future use of
testing.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#70 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAKtYsOuj7dhZuQ0qQI5AugC__NaXaXks5sR3vqgaJpZM4Ogb-S>
.
|
No problem! Will get them back :)
On Jul 26, 2017 8:43 PM, "David Heinemeier Hansson" <
notifications@github.com> wrote:
… Would probably be good to get AV and Sprockets back in, yeah, because
@javan is just about ready with his direct upload JS PR.
Thanks for working on this, Dino!
On Wed, Jul 26, 2017 at 12:48 PM, Dino Maric ***@***.***>
wrote:
> @kaspth <https://github.com/kaspth> yes we would! That was my initial
> approach just to remove action cable and action mailer and leave other
> components in there (for the future). But, there were was concerned with
> the size of the dummy so I just created it as small as "possible", to
cover
> current use.
>
> The full dummy app would be most flexible/easy for the future use of
> testing.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#70 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/
AAAKtYsOuj7dhZuQ0qQI5AugC__NaXaXks5sR3vqgaJpZM4Ogb-S>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#70 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHFVJe-8EB1mhaAIcUPWk6tB7wPgZ3Yiks5sR4jkgaJpZM4Ogb-S>
.
|
There are a couple of conflicts against master, btw. |
* Convert controller tests to integration tests * Move storage confogurations to dummy * Remove unecessary requires
28b1d3d
to
fa20b41
Compare
I've add back ActionView, Sprockets.... Now the dummy is larger because there is not a lot we can remove. I've removed ActionCable, ActionMailer and few config files. IMO it is not worth removing more, because we are going off the rails 😃 🚂 |
The build is currently failing. Can you have a look? |
fa20b41
to
d92b9f7
Compare
@dhh oh, sorry I fixed it :) |
First step:
r? @dhh
We could slim down a bit this dummy, to remove rails components that are not used at the moment, ex: ActionCable ?