mardi 24 mars 2015

Functional tests with Minitest in Ruby 2.2.1

In Ruby 2.0.0, my controller tests looked something like this:



class CustomerControllerTest < ActionController::TestCase

test "when not logged in" do
order = FactoryGirl.create(:order)
get(:order, { id: order.id })
assert_redirected_to "/customer/sign_in"
end

end


Unfortunately, this no longer works in Ruby2.2. The tests still run, but all I get is this:



Finished in 0.000090 seconds.

0 tests, 0 passed, 0 failures, 0 errors, 0 skips, 0 assertions


I've managed to get my unit tests to work by converting them to use MiniTest::Unit::TestCase, but I don't see any way to test controller actions using MiniTest on it's own.


So my question is, is there a way to get ActionController::Testcase to work with Ruby2.2 in Rails 3.2, and if not, is there a way to test controller actions using MiniTest::Unit::TestCase?


Aucun commentaire:

Enregistrer un commentaire