Skip to content

Specs fail because an rspec double is leaking across tests #105

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

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

jasonkarns
Copy link
Contributor

The Rails.logger double (via as_null_object) is leaking across tests. It is pulled from ::Rails and set as ::Graphiti.logger which, as a constant, persists across specs.

This resets Graphiti's config after the railtie specs which stub on it.

Also, the railtie test can't run without configuring rspec (via some helpers) and loading the Railtie under test. Ideally we'd use a slimmed-down spec_helper for configuring just rspec (without rails). However, that doesn't already exist, and we'd need some form of autoloading anyway; so for the time being we just use the existing rails_helper.

jasonkarns and others added 3 commits March 12, 2023 12:52
If spec_helper existed, we could have a smaller rspec configuration that
did not depend on rails. However, without it, we would need the spec to
load the unit under test as well as rspec and its configuration. It
seems the pattern is to load rails_helper in all specs in order to
configure rspec while also getting rails' autoloading.
@jkeen jkeen merged commit b38faf2 into graphiti-api:master Mar 18, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Mar 21, 2025
## [0.4.1](v0.4.0...v0.4.1) (2025-03-21)

### Bug Fixes

* `register_parameter_parser` overiding custom config ([#109](#109)) ([a135bfa](a135bfa))
* Add basic column type conversion. ([#83](#83)) ([e5bbc92](e5bbc92))
* Add condition to check RSpec availability in install generator ([#63](#63)) ([13895d9](13895d9))
* rspec double was leaking across tests ([#105](#105)) ([b38faf2](b38faf2))
* Stringify path if Rails version > 7 ([#107](#107)) ([47d356c](47d356c))
Copy link

🎉 This PR is included in version 0.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants