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

Add `ActiveSupport::Testing::FileFixtures`. #18658

Merged
merged 1 commit into from Jan 28, 2015

Conversation

Projects
None yet
6 participants
@senny
Member

senny commented Jan 23, 2015

It's a thin layer to provide easy access to sample files throughout
test-cases. This adds the directory test/fixtures/files to newly
generated applications.

This is something that came up in a discussion with @dhh

Most of our applications have helpers to access some kind of sample files. Possible use-cases are:

  • Test file uploads
  • Sample output to compare generated documents (.csv, .docx, .pdf, ...)
  • content used in test-cases like xml snippets.
  • ...
@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Jan 23, 2015

Member

@carlosantoniodasilva @rafaelfranca @dhh interested to hear your thoughts.

The method names feel a bit awkward to me but it's the best I could come up with.

Member

senny commented Jan 23, 2015

@carlosantoniodasilva @rafaelfranca @dhh interested to hear your thoughts.

The method names feel a bit awkward to me but it's the best I could come up with.

@senny senny added this to the 5.0.0 milestone Jan 23, 2015

@senny senny added the activesupport label Jan 23, 2015

@arthurnn

This comment has been minimized.

Show comment
Hide comment
@arthurnn

arthurnn Jan 23, 2015

Member

🆒

Member

arthurnn commented Jan 23, 2015

🆒

@vipulnsward

This comment has been minimized.

Show comment
Hide comment
@vipulnsward

vipulnsward Jan 23, 2015

Member

Nice. @senny it would be awesome if this could be extended to support passing a file in controller requests in tests. Thoughts?

Member

vipulnsward commented Jan 23, 2015

Nice. @senny it would be awesome if this could be extended to support passing a file in controller requests in tests. Thoughts?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Jan 23, 2015

Member

Seems good to me.

Member

rafaelfranca commented Jan 23, 2015

Seems good to me.

@robin850

View changes

Show outdated Hide outdated activesupport/lib/active_support/testing/file_fixtures.rb
@robin850

View changes

Show outdated Hide outdated activesupport/lib/active_support/testing/file_fixtures.rb
@robin850

View changes

Show outdated Hide outdated activesupport/lib/active_support/testing/file_fixtures.rb
@carlosantoniodasilva

View changes

Show outdated Hide outdated railties/lib/rails/test_help.rb
@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Jan 26, 2015

Member

I wonder if we should touch fixture_file_upload to make use of this new files directory rather than the normal fixtures_path in this case?

Other than that it seems good to me, good to have something simple builtin to help with that.

Member

carlosantoniodasilva commented Jan 26, 2015

I wonder if we should touch fixture_file_upload to make use of this new files directory rather than the normal fixtures_path in this case?

Other than that it seems good to me, good to have something simple builtin to help with that.

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Jan 28, 2015

Member

I changed the configuration option to file_fixture_path and the methods to file_fixture and file_fixture_content.

@carlosantoniodasilva what do you think?

Member

senny commented Jan 28, 2015

I changed the configuration option to file_fixture_path and the methods to file_fixture and file_fixture_content.

@carlosantoniodasilva what do you think?

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Jan 28, 2015

Member

Cool, I like it better 👍, do you prefer like this?

Would you think that leaving the "read" logic for the developers wouldn't be fine? I mean, we could use file_fixture('zomg.txt').read directly on the tests, and only introduce this helper method with the config.

Member

carlosantoniodasilva commented Jan 28, 2015

Cool, I like it better 👍, do you prefer like this?

Would you think that leaving the "read" logic for the developers wouldn't be fine? I mean, we could use file_fixture('zomg.txt').read directly on the tests, and only introduce this helper method with the config.

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Jan 28, 2015

Member

@carlosantoniodasilva 👍 I think we can get rid of _content and delegate .read to the user. I'll try to cover it in the documentation. Once that base-layer is merged we can start talking about fixture_file_upload.

Member

senny commented Jan 28, 2015

@carlosantoniodasilva 👍 I think we can get rid of _content and delegate .read to the user. I'll try to cover it in the documentation. Once that base-layer is merged we can start talking about fixture_file_upload.

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Jan 28, 2015

Member

Alright, great 👍 ❤️

Member

carlosantoniodasilva commented Jan 28, 2015

Alright, great 👍 ❤️

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Jan 28, 2015

Member

@carlosantoniodasilva mind a final 👀?

Member

senny commented Jan 28, 2015

@carlosantoniodasilva mind a final 👀?

@carlosantoniodasilva

View changes

Show outdated Hide outdated activesupport/CHANGELOG.md
@carlosantoniodasilva

View changes

Show outdated Hide outdated activesupport/lib/active_support/testing/file_fixtures.rb
@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Jan 28, 2015

Member

💚💛❤️💙💜

Member

carlosantoniodasilva commented Jan 28, 2015

💚💛❤️💙💜

introduce `ActiveSupport::Testing::FileFixtures`.
It's a thin layer to provide easy access to sample files throughout
test-cases. This adds the directory `test/fixtures/files` to newly
generated applications.

senny added a commit that referenced this pull request Jan 28, 2015

Merge pull request #18658 from senny/file_fixtures
Add `ActiveSupport::Testing::FileFixtures`.

@senny senny merged commit 58047eb into rails:master Jan 28, 2015

1 check was pending

continuous-integration/travis-ci The Travis CI build is in progress
Details

@senny senny deleted the senny:file_fixtures branch Jan 28, 2015

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny Jan 28, 2015

Member

@carlosantoniodasilva thanks man!!! 💛

Member

senny commented Jan 28, 2015

@carlosantoniodasilva thanks man!!! 💛

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Jan 29, 2015

Member

thank you 👍 💙

Member

carlosantoniodasilva commented Jan 29, 2015

thank you 👍 💙

@rafaelfranca rafaelfranca modified the milestones: 5.0.0 [temp], 5.0.0 Dec 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment