How to organize minitest/unit tests?

后端 未结 3 1652
孤独总比滥情好
孤独总比滥情好 2021-02-04 23:39

After using RSpec for several projects, I\'m giving minitest/unit a go. I\'m liking it so far, but I miss using describe/context blocks to group my tests/specs in a logical way.

3条回答
  •  孤独总比滥情好
    2021-02-04 23:59

    I prefer this way (only a little bit) but I think it easier to follow:

    class ConventionalNameTest < ActiveSupport::TestCase
      class ContextTest < ConventionalNameTest
        # so much stuff...
      end
      class AnotherContextTest < ConventionalNameTest
        # and some more...
      end
    

提交回复
热议问题