ruby - rspec require spec_helper in .rspec file -


i've noticed projects such bundler require spec_helper in each spec file

i've noticed rspec takes option --require, allows require file when rspec bootstrapped. can add .rspec file, added whenever run rspec no arguments.

are there disadvantages using above method might explain why projects such bundler choose require spec_helper in each spec file?

i don't work on bundler can't speak directly practices. not projects check-in .rspec file. reason file, current convention, has personal configuration options general output / runner preferences. if required spec_helper there, others wouldn't load it, causing tests fail.

another reason, not tests may need setup performed spec_helper. more there have been groups of rubyists trying move away loading many dependencies test. making explicit when spec_helper required in test people have idea may going on. also, running single test file or directory doesn't need setup faster.

in reality, if of tests requiring spec_helper , you've make clear convention on project there's no technical reason can't or shouldn't it. may initial surprise new people join project.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -