minitest

Before/After Suite when using Ruby MiniTest

会有一股神秘感。 提交于 2019-11-28 08:01:51
Is there an alternative to RSpec's before(:suite) and after(:suite) in MiniTest? I suspect that a custom test runner is in order, however I cannot imagine it is not a common requirement, so somebody has probably implemented in. :-) Caley Woods There are setup() and teardown() methods available. The documentation also lists before() and after() as being available. Edit: Are you looking to run something before each test or before or after the whole suite is finished? As noted above in Caley's answer and comments, MiniTest::Unit contains the function after_tests . There is no before_tests or

How to run all tests with minitest?

半城伤御伤魂 提交于 2019-11-27 19:34:14
I downloaded source code for a project, found a bug, and fixed it. Now I want to run tests to find out if I have broken anything. The Tests are in minitest DSL. How do I run them all at once? I searched for applicable rake tasks etc, but I didn't find any. locks Here's a link to Rake::TestTask . There is an example in the page to get you started. I'll post another one that I'm using right now for a gem: require 'rake/testtask' Rake::TestTask.new do |t| t.pattern = "spec/*_spec.rb" end As you can see, I assume that my files are all in /lib and that my specs are in /spec and are named whatever

Why doesn't MiniTest::Spec have a wont_raise assertion?

懵懂的女人 提交于 2019-11-27 03:03:38
问题 Ruby's Test::Unit has assert_nothing_raised . Test::Unit has been replaced by MiniTest. Why don't MiniTest's assertions / expectations have anything parallel to this? For example you can expect must_raise but not wont_raise . 回答1: MiniTest does implement assert_nothing_raised in its Test::Unit compatibility layer, but in its own tests ( MiniTest::Unit and MiniTest::Spec ) it does not implement any test like this. The reason is, the programmer argues, that testing for nothing raised is not a