If an AWS bucket name includes a `.` (e.g. `bucket.name`), then the canonical
URL for an object will start with "https://s3.amazonaws.com/bucket.name/"
and not with "https://bucket.name.s3.amazonaws.com/".
The URL tests have now been separated into two separate asserts, to ensure
that both the "s3.amazonaws.com" and the "bucket.name" components are included,
but not specifically in that order.
We are already removing the braces around hash parameters in the last
argument in other places so we should not change the entire codebase
because of two places.
Running `rubocop activestorage` before this commit resulted in 20 offenses.
This commit only fixes:
- Trailing whitespace detected
- Space inside } missing
- Put one space between the method name and the first argument.
The other offenses are left since they are intentional according to
@georgeclaghorn (https://github.com/rails/rails/pull/30061#issuecomment-319999190)
"httparty" is only added in #30020 to write two tests to make PUT requests
against S3 and GCS.
The same requests can be made with net/http, removing a dependency from the Gemfile.
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.