I found resources for configuring Rails to use Minitest. Most of the resources, unfortunately, assume the use of Minitest Spec for all the test types or, in the best case, at least for the integration test.
I may be "vintage", but I feel the assertions ala test:unit work better for me than the rspec style. I would use MiniTest::Unit declaration style, together with Capybara, to run the integration tests.
I am interested in seeing an example of minitest_helper.rb and some_model_integration_test.rb to understand the relevant configuration elements I need to put in place to make the integration test work nicely with Capybara.
Can somebody explain how to configure Rails for this?
My articles_integration_test.rb
:
require 'test_helper'
class ArticlesIntegrationTest < IntegrationTest
def test_shows_article_title
article = Article.create!(title: 'Foo bar')
visit article_path(article)
assert page.has_content?('Foo bar')
end
end
My test_helper.rb
:
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "minitest/autorun"
require "capybara/rails"
require "active_support/testing/setup_and_teardown"
class IntegrationTest < MiniTest::Unit::TestCase
include Rails.application.routes.url_helpers
include Capybara::DSL
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With