Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This question is similar to <a href="https://stackoverflow.com/questions/4788288/how-to-run-all-the-tests-with-minitest">How to run all tests with minitest?</a></p> <p>Using Ruby 1.9.3 and Rake 0.9.2.2, given a directory layout like this:</p> <pre><code>Rakefile lib/alpha.rb spec/alpha_spec.rb </code></pre> <p>Here is what <code>alpha_spec.rb</code> might look like:</p> <pre><code>require 'minitest/spec' require 'minitest/autorun' # arranges for minitest to run (in an exit handler, so it runs last) require 'alpha' describe 'Alpha' do it 'greets you by name' do Alpha.new.greet('Alice').must_equal('hello, Alice') end end </code></pre> <p>And here's <code>Rakefile</code></p> <pre><code>require 'rake' require 'rake/testtask' Rake::TestTask.new do |t| t.pattern = 'spec/**/*_spec.rb' end </code></pre> <p>You can run</p> <ul> <li><strong>all tests:</strong> <code>rake test</code></li> <li><strong>one test:</strong> <code>ruby -Ilib spec/alpha_spec.rb</code></li> </ul> <hr> <p>I don't know if using a <code>spec_helper.rb</code> with minitest is common or not. There does not appear to be a convenience method for loading one. Add this to the Rakefile:</p> <pre><code>require 'rake' require 'rake/testtask' Rake::TestTask.new do |t| t.pattern = 'spec/**/*_spec.rb' t.libs.push 'spec' end </code></pre> <p>Then <code>spec/spec_helper.rb</code> can contain various redundant things:</p> <pre><code>require 'minitest/spec' require 'minitest/autorun' require 'alpha' </code></pre> <p>And <code>spec/alpha_spec.rb</code> replaces the redundant parts with:</p> <pre><code>require 'spec_helper' </code></pre> <ul> <li><strong>all tests:</strong> <code>rake test</code></li> <li><strong>one test:</strong> <code>ruby -Ilib -Ispec spec/alpha_spec.rb</code></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload