Question

I've used Minitest on several projects (both strictly Ruby and Rails) and haven't had much of an issue. I just set up a Rails 4 project with Minitest and can't get the tests to run for some reason. This must be a stupid mistake on my part, but I can't see it.

The "error", "minitest running 0 tests", happens whether I use rake or ruby Itest.

I should also say that I know the test file is being recognized because if I take out the describe block, and just have it should..., I get a NoMethodError - undefined method "it" for CalendarMakerTest:Class.

#test

require 'test_helper'

class CalendarMakerTest < ActionView::TestCase

  describe "subject" do
    it "does something" do
      assert_equal false
    end
  end

end

#test_helper

require 'minitest/autorun'
require 'minitest/spec'

ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'


class ActiveSupport::TestCase
  ActiveRecord::Migration.check_pending!

end

$ruby -Itest test/helpers/calendar_maker_test.rb

Run options: --seed 33758

# Running tests:



Finished tests in 0.035027s, 0.0000 tests/s, 0.0000 assertions/s.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
Était-ce utile?

La solution

You can remove the line

class CalendarMakerTest < ActionView::TestCase

Along with the corresponding end statement. You will have better luck.

You are mixing up the ways to use Minitest with the spec and the autotest methodology.

You also don't technically need require minitest/spec when you require minitest/autorun.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top