Earlier quoted context omitted.
Interesting. Why would the requires go stale? And how would you use a dependency you don't require? It wouldn't be possible to use it unless you required it. This of course assumes you're testing your classes in isolation.
I think that isolation testing files is considerably harder than isolation testing classes . You can't force isolation of one by using isolation of the other. For requires going stale, I mean when a file originally depends on something but no longer does. The require is likely to linger, especially if the dependency is removed without knowing that it was the entirety or the last of the dependency. This file now has s…
Use Bundler.setup Instead of Bundler.require
11–15 of 15 posts
Re: Use Bundler.setup Instead of Bundler.require
#12Re: Use Bundler.setup Instead of Bundler.require
#13Another thing to consider is thread safety. "require" is not thread safe, so if your app is multi-threaded, it's actually a good idea to load everything up front. Granted, you can still do this with manual requires, but Bundler.require does that job for you pretty nicely.
Re: Use Bundler.setup Instead of Bundler.require
#14I'm not sure that there's really any way to give a firm recommendation either way here. You can, after all, simply add :require => false to any gems which you don't want to require with Bundler.require. > Manually requiring dependencies at the top of every file very explicitly tells you and anyone else exactly what dependencies that file has. While I don't disagree with this statement, I don't really know of any way…
Yes, but, if you test your classes in isolation, then you'll be forced to manually require each dependency at the top of the file.
Again, I tend to agree with you more than I disagree. I think were I disagree is in making it a recommendation -- if someone is on point enough to effectively use Bundler.setup, I don't know that they need to have it recommended to them; they just need to know the difference between Bundler.setup and Bundler.require. On the other hand, if someone does need a recommendation and not a description, I'm not sure that either is the appropriate response.
I guess at the end of the day, I'm just not looking forward to the change-sets this might generate ;)
Re: Use Bundler.setup Instead of Bundler.require
#15Earlier quoted context omitted.
I think that isolation testing files is considerably harder than isolation testing classes . You can't force isolation of one by using isolation of the other. For requires going stale, I mean when a file originally depends on something but no longer does. The require is likely to linger, especially if the dependency is removed without knowing that it was the entirety or the last of the dependency. This file now has s…
Ah, well, nothing is foolproof. Yes, if you don't update your dependency list when dependencies are removed, they might get stale. But I keep up on that stuff and haven't ran into that problem yet. Even if I did, I'd rather have that problem than an app where all the dependencies are global.