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

Cleanup tests #164

Merged
merged 10 commits into from
Feb 27, 2023
Merged

Cleanup tests #164

merged 10 commits into from
Feb 27, 2023

Conversation

kiskoza
Copy link
Member

@kiskoza kiskoza commented Feb 26, 2023

Hi. I was working on #163 and as I mentioned there, it was a bit difficult for me to get familiar with the test suite, so I started to move things around and in the end I got these changes running. I know it's a lot, so I'll try to get a list of what I've done:

  1. Merge all dummy apps
    They were almost the same apps, I only had to insert a few version checks, e.g.: spec/rails_app/app/controllers/users_controller.rb. This way we have less code to maintain and easier to add a new spec for all versions.

  2. Create a few gemfiles
    This way you can run BUNDLE_GEMFILE=spec/gemfiles/Gemfile.rails-X.Y bundle install to install the gems and BUNDLE_GEMFILE=spec/gemfiles/Gemfile.rails-X.Y bundle exec rspec to run the specs. I think it's easier to delete and old version when we don't support it anymore. Not sure if we need to add something to the Readme about this.

  3. Update github actions to pick up all versions
    I had to define the bundler version for Rails 4.2 and exclude a few combunations, e.g. Rails 7 does not support older Ruby versions. Other than that we're running the full matrix.

  4. Fix tests for Rails 6.1 & 7.0
    In lib/axlsx_rails/railtie.rb we required the template handler only after action_view already loaded, which does not happen in the rspec for some reason. I simply moved the require line out from the on_load block. As it's just a simple plain old ruby class, it shouldn't do any harm - apart from loading the action_view unnecessarily... it was only required to have the template handler in ActionView's namespace (which we shouldn't do, all the gem codes should live under the gem's namespace anyways), so I also renamed the template handler and removed the inclusion of action_view

  5. Delete all the .sh files as we don't need them anymore

I hope this all makes sense and we can merge it in to make this gem more maintainable

@straydogstudio
Copy link
Collaborator

@kiskoza Thanks for all the work. This is great. It's just the kind of thing I was hoping to do at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants