Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Add rails_helper #905

Merged
merged 6 commits into from
Jan 7, 2018
Merged

Add rails_helper #905

merged 6 commits into from
Jan 7, 2018

Conversation

carpodaster
Copy link
Member

This PR moves the Rails specific config to spec/rails_helper.rb. It's the default for the rspec-rails gem for quite a while now and also enables unit-testing without loading the Rails environment (= takes looong) by just requiring spec/spec_helper.rb (which is indeed required automatically by .rspec now).

@@ -34,7 +34,7 @@
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
mocks.verify_partial_doubles = false
Copy link
Member Author

Choose a reason for hiding this comment

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

I've created a follow up issue: #906

Copy link
Member

@emcoding emcoding left a comment

Choose a reason for hiding this comment

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

Yay! This is great to have! Very neat.
(Always wondered what would be the best way to combine the two helpers, never got to figuring it out.)

There are also a few Rspec.configs in the spec/support/ dir. Personally, I wouldn't mind combining all of them in the rails_helper, instead of hidden away in a separate dir.
Un-personally, I wondered when the separate files are loaded, and if adding them to the relevant *_helper would also be an optimization?

coverage_dir File.join('coverage', Time.now.strftime('%Y%m%d-%H%M%S'))
end
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 you mind to add a comment that the Coverage things need to be at the top of the file?
I had to look that up, because it looks contrary to line 26 "Add additional requires below this line".

Copy link
Member

Choose a reason for hiding this comment

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

🙇 thanks :-)

[ci skip]
@carpodaster
Copy link
Member Author

carpodaster commented Jan 7, 2018

@F3PiX I have no hard feelings for or against moving the config calls in spec/support. I wouldn't do this in this PR, though. D'accord?

Copy link
Member

@klappradla klappradla left a comment

Choose a reason for hiding this comment

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

Great 💚 - thanx a lot! Another step on the way to having everything super modern here 💯 😉

@klappradla klappradla merged commit ec684be into master Jan 7, 2018
@klappradla klappradla deleted the refactoring/rails_helper branch January 7, 2018 17:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants