Skip to content
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

DRY specs with fixture_file_upload helper #12013

Merged
merged 4 commits into from
Jan 9, 2024

Conversation

mkllnk
Copy link
Member

@mkllnk mkllnk commented Jan 8, 2024

What? Why?

I noticed a mixture of our own file helpers and plenty of references to Rack::Test::UploadedFile with many repetitions of the same paths. So I removed repetitions and favoured fixture_file_upload to simplify the code and minimise confusion about what the best practice is.

What should we test?

  • No test.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

@mkllnk mkllnk added the technical changes only These pull requests do not contain user facing changes and are grouped in release notes label Jan 8, 2024
@mkllnk mkllnk self-assigned this Jan 8, 2024
@mkllnk mkllnk marked this pull request as ready for review January 8, 2024 02:37
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!

@@ -9,7 +9,7 @@

describe "uploading an image" do
let(:image) { black_logo_file }
let(:pdf) { Rack::Test::UploadedFile.new(pdf_path, 'application/pdf') }
let(:pdf) { fixture_file_upload(pdf_path, 'application/pdf') }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about fixture_file_upload

Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@dacook dacook merged commit c95d752 into openfoodfoundation:master Jan 9, 2024
52 checks passed
@mkllnk mkllnk deleted the spec-file-helper branch February 8, 2024 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical changes only These pull requests do not contain user facing changes and are grouped in release notes
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants