metaskills / minitest-spec-rails

:bento: Make Rails Use MiniTest::Spec!

Home Page:http://github.com/metaskills/minitest-spec-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rails 3.2.22.2 / MiniSpecRails 4.7.9 - ActionController::TestCase incompatible with "tests" method

subimage opened this issue · comments

commented

I have the need to test certain controllers under non-normal circumstances. These tests are not named according to controller name, and are throwing errors because of that. In ActionController::TestCase there's a class method called "tests" that is supposed to enable you to describe the test case in question. It's not working in MiniSpecTest.

# working
class CompaniesControllerTest < ActionController::TestCase
  def test_truth
    assert true
  end
end

# not working
class SpecialCompaniesControllerTest < ActionController::TestCase
  tests CompaniesController
  def test_truth
    assert true
  end
end

Renaming the class to 'SpecialCompaniesControllerTest' starts throwing weird errors like so:

E /vendor/ruby/2.1.0/gems/actionpack-3.2.22.2/lib/action_controller/test_case.rb @ 378
SpecialCompaniesControllerTest
  test_truth
  !! ArgumentError
  controller class must be a String, Symbol, or Class
  /Users/seth/Work/cashboard/app/vendor/ruby/2.1.0/gems/actionpack-3.2.22.2/lib/action_controller/test_case.rb:378:in `tests'

E /vendor/ruby/2.1.0/gems/activerecord-3.2.22.2/lib/active_record/fixtures.rb @ 878
SpecialCompaniesControllerTest
  test_truth
  !! NoMethodError
  undefined method `each' for nil:NilClass
  /Users/seth/Work/cashboard/app/vendor/ruby/2.1.0/gems/activerecord-3.2.22.2/lib/active_record/fixtures.rb:878:in `teardown_fixtures'
  /Users/seth/Work/cashboard/app/vendor/ruby/2.1.0/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:405:in `_run__3656525468224606978__teardown__2713731447860676535__callbacks'
  /Users/seth/Work/cashboard/app/vendor/ruby/2.1.0/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:405:in `__run_callback'
  /Users/seth/Work/cashboard/app/vendor/ruby/2.1.0/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:385:in `_run_teardown_callbacks'
  /Users/seth/Work/cashboard/app/vendor/ruby/2.1.0/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:81:in `run_callbacks'

Indeed! Made a simple test in this integration app since 3.0 to 4.0 uses our 3-x-stable branch (v4.7.9) and it did the same thing. Looking into it now.

OK, just pushed out v4.7.10 with this fix. Closing this issue, but let me know if anything else comes up or this did not fix it.

commented

Very appreciative of the quick response and fix on this. New version resolved my issues. Thank you!