thought-driven / bummr

Update your gems in separate commits. Identify any that fail your build.
MIT License
234 stars 23 forks source link

Testing approach #43

Closed odlp closed 6 years ago

odlp commented 7 years ago

Whilst making a contribution yesterday I noticed a couple of areas of the test suite that could potentially be improved.

In particular there's quite a bit of stubbing private methods, including the subject under test, which is often considered an antipattern (reference from Sam Phippen's blog - an RSpec core member). Here's one instance of this:

allow_any_instance_of(described_class).to receive(:gemfile).and_return gemfile

Additionally, by making many of the core Bummr classes Singletons this forces the use of #allow_any_instance_of which is listed under RSpec's 'testing legacy code' section and isn't recommended.

Would you be open to PRs to inject dependencies and alter these tests so stubbing the subject under test & global constants can be avoided?

No problem if this isn't of interest - I just wanted to see if I can help improve this handy tool.


The code below is a quick illustration of how this rewrite would look for the Bummr::Outdated class.

lpender commented 7 years ago

Hey, would definitely be open to a rethink of the testing strategy here!

lpender commented 7 years ago

@odlp I'm wondering--Would you be interested in becoming a collaborator on the project?

I've got quite a bit going on at the moment and not sure that I could give this my fullest attention, but I like the consideration and thought that you've put into your work thus far.

Let me know!

odlp commented 7 years ago

@lpender sure, I'd be interested in helping out!

emilianoLeite commented 6 years ago

:+1:

emilianoLeite commented 6 years ago

Speaking of tests, the issue blocking the development of feature tests seems to be stale for a while now. @lpender, do you think there is any alternate possibility for the development of feature tests in bummr?

lpender commented 6 years ago

@odlp This is a slow moving one, but I went ahead and added you as a contributor!

Can you email me at lee@lunchtimelabs.io when you have a moment?

Thanks