4 ms·
Would you say Rspec is better than the Python equivalents like behave or pytest-BDD? Curious as I've never worked with Ruby/Rails but I'm aware there are some t
by theptip 6y ago
Would you say Rspec is better than the Python equivalents like behave or pytest-BDD? Curious as I've never worked with Ruby/Rails but I'm aware there are some things that are way ahead of other toolchains (and others that are way behind as you've noted).
- viraptor 6y agoDefine "better". The mocking story and the rspec syntax itself is insanely better than in python. But the actual internals are pretty much comparable in my opinion.
- leetrout 6y agoYes. I would use the tooling inspired by the Ruby tools like factory boy and stick with pytest over behave, personally. I’ve not used pytest-bdd. In JS mocha or jest are both great.
- herpderperator 6y agoRSpec is definitely better, but I've mimicked it this way with pytest because I didn't like each Given/When decorator in pytest-bdd requiring a separate method to setup. It was way too verbose. I want to be able to quickly nest them, like in RSpec. So I do: TestSomeMethod: TestWhenDateProvided: def test_it_does_not_use_system_date(fixture, ...): assert ... TestWhenDateNotProvided: def test_it_uses_system_date(fixture, ...): assert ...
- theptip 6y agoAh so you’d say the nested setup is one thing that differentiates Rspec. I’d use inherited test classes for this case, either sharing the setup in the parent and having each child define their own tests, or defining the test cases in the parent and overriding the setup in the child classes. Seems like the latter might be hard in Rspec? But the former sounds more concise in the Rspec notation, I agree. I think Ruby’s anonymous blocks seem to be the differentiator in the toolset, I’ve not seen a Python DSL that’s as good in that regard.