Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Errors in before blocks are muted if running with minitest-spec-rails #64

Closed
ansel1 opened this Issue · 1 comment

2 participants

@ansel1

Here's some test code that fails to print the exception thrown from the before block:

ENV["RAILS_ENV"] = "test"
require File.expand_path('../../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/reporters'
require 'minitest/autorun'
MiniTest::Reporters.use!


# must be a *Controller test to fail
describe PasswordsController do
  describe 'heynow' do
    describe 'something' do
      before do
        puts 'noting'
        raise Exception.new
      end

      it 'does something' do
        assert true
      end
    end
  end
end

minitest-spec-rails makes this describe block result in an ActionControllerTest subclass. This results in ActiveSupport::Testing::SetupAndTeardown::ForMiniTest being included in the test class. This module runs before callbacks around the entire runner.run() method. I think this means your before_test callback is never call (if the before block throws an exception), so your report recording isn't turned on yet.

What results is all green, no exception printed to log, but the test passed vs total test number doesn't match, final test count summary line does report that an error occurred, and rake test returns not-ok return code.

@kern kern closed this issue from a commit
Alex Kern Fix the color of the progress bar on error
Closes #64.
b860c8f
@kern kern closed this in b860c8f
@kern
Owner

This should be fixed in 0.14.11. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.