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

Allow enabling/disabling IronTrail in rspec #9

Merged
merged 8 commits into from
Dec 9, 2024
Merged

Conversation

andrepiske
Copy link
Collaborator

@andrepiske andrepiske commented Dec 6, 2024

Jira task

This PR adds functionality to enable/disable IronTrail in specs. See the README.md diff for more detail.

@andrepiske andrepiske marked this pull request as ready for review December 6, 2024 12:06
@andrepiske andrepiske self-assigned this Dec 6, 2024
Copy link
Member

@peterbrendel peterbrendel left a comment

Choose a reason for hiding this comment

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

left some thoughts and suggestions, but it's looking good

README.md Outdated Show resolved Hide resolved
@enabled = true
end

def disable!
Copy link
Member

Choose a reason for hiding this comment

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

It's unlikely to happen since you need to require this, but one might do it in a rails console, I'd like iron_trail to protect me from doing this in production

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed. I'll add a protection if ENV['RAILS_ENV'] == 'production'


require 'iron_trail/testing/rspec'

IronTrail::Testing.disable!
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: also add a test where it is enabled by default, to ensure that iron_trail: false is working properly

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +3 to +6
if ENV['RAILS_ENV'] == 'production'
raise 'This file should not be required in production. ' \
'Change the RAILS_ENV env var temporarily to override this.'
end
Copy link
Member

Choose a reason for hiding this comment

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

Would raising here stop the application from booting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep 👍

Base automatically changed from allow-disabling-tracking-on-ignored to main December 9, 2024 09:40
@andrepiske andrepiske merged commit 2c85696 into main Dec 9, 2024
7 checks passed
@andrepiske andrepiske deleted the rspec-helpers branch December 9, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants