-
Notifications
You must be signed in to change notification settings - Fork 28
Correctly merge signature and expire params in UploadParamsGenerator #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,13 @@ module Upload | |||||||||||||||||||||||||||||||||||
| expect(params['UPLOADCARE_PUB_KEY']).not_to be_nil | ||||||||||||||||||||||||||||||||||||
| expect(params['UPLOADCARE_STORE']).not_to be_nil | ||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| it 'generates upload params with signature if sign_uploads is true' do | ||||||||||||||||||||||||||||||||||||
| Uploadcare.config.sign_uploads = true | ||||||||||||||||||||||||||||||||||||
| params = subject.call | ||||||||||||||||||||||||||||||||||||
| expect(params['signature']).not_to be_nil | ||||||||||||||||||||||||||||||||||||
| expect(params['expire']).not_to be_nil | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+24
|
||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restore config state after test to prevent test pollution. The test modifies the global Apply this diff to ensure the config is restored: it 'generates upload params with signature if sign_uploads is true' do
+ original_value = Uploadcare.config.sign_uploads
Uploadcare.config.sign_uploads = true
params = subject.call
expect(params['signature']).not_to be_nil
expect(params['expire']).not_to be_nil
+ensure
+ Uploadcare.config.sign_uploads = original_value
end📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
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.
The test for SignatureGenerator in spec/uploadcare/param/upload/signature_generator_spec.rb still expects symbol keys (
:signatureand:expire), but this change returns string keys. The test at line 13 definesexpected_resultwith symbol keys and will fail with this implementation. The expected result in the test should be updated to use string keys to match this change.