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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jasonkarns
Copy link

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.

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.
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.

1 participant