Skip to content

Conversation

@godfat
Copy link

@godfat godfat commented Jul 14, 2014

Pork -- Simple and clean and modular testing library.
Bacon reimplemented around 250 lines of code.

@CrowdHailer
Copy link

What is the reason for either of these beat minitest or test unit?
Why both of them in pork is a reimplementation of bacon?
Does adding the .should methods not fall foul of some of our ideas on good object design? I get that testing is a slightly special case and monkey patching in tests in not as damaging as in production but still I think I would like it justified
Do you have any examples of it in production?

@godfat
Copy link
Author

godfat commented Jun 25, 2015

Sorry for my phrase if it's confusing. Bacon was inspired by RSpec, and Pork was inspired by Bacon.

I don't know what other people would think, but to me, the advantage of this kind of libraries is that we could easily write nested tests, sharing before/after blocks easily. Also, using closures is sometimes more convenient. Writing test_this_is_an_apple is also more tedious.

I know that there's minitest/spec, but I have never tried it so I can't really say. Maybe using it would be better than bacon or pork or rspec. I should probably try some day.

As for the .should method. In Bacon there's only .should, however in Pork there's also expect which is not patching Kernel. Just pick whatever you like. As for why .should still has its place, I think yes, testing is a slightly special case and it's sometimes much easier to write it this way. The test would look a bit more clearly, too. It's arguable though of course. It's a flavor.

As for production... I am not sure why one would do so in production. I do have something like this though:

raise "Assert a = b" unless a == b

This is good enough for me on production rather than using some fancy testing libraries.

@solnic
Copy link
Contributor

solnic commented Jun 25, 2015

I don't mind adding a small testing lib. So 👍

@noahc
Copy link

noahc commented Oct 18, 2015

Rspec has moved away from the should syntax to avoid monkey patching and is now using the expect. Seems like merging in Bacon makes sense, I'm less convinced of Pork.

Any reason this isn't merged in yet?

@godfat
Copy link
Author

godfat commented Oct 19, 2015

Could you let me know why you're less convinced of Pork?

I don't know why this isn't merged.

@noahc
Copy link

noahc commented Oct 19, 2015

There are two reasons. The first is line count. 327 vs 896. To me, micro is ~500 lines.

The other is that pork allows for monkey patching. I saw that you could avoid it by not requiring it, so that is a positive direction.

Honestly, I'd be in favor of merging this with both of them, than just have it continue to sit out here.

@godfat
Copy link
Author

godfat commented Oct 19, 2015

Both bacon and pork have optional codes (plugins or different formatters), and some stuffs in pork won't load by default. I should probably extract plugins from pork, but maybe not now though. Frankly it's a bit ironic. Pork used to only have 250 lines of code...

Thanks for the feedback.

@solnic ping? Should we merge this, or make some changes, or close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants