No release in over 3 years
Overrides rails controller generator to generate an integration test instead of a controller test
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 7.0
>= 0

Runtime

>= 7.0, <= 8.1
 Project Readme

rails-integration-test-generator Gem Version Build Status

rails-integration-test generator overrides the controller generator to generate an integration test rather than the default controller test, which is really just a mislabeled integration test anyway.

Usage

Just add this to your gemfile:

gem "rails-integration-test-generator"

This gem has been tested with Rails versions 7.0-8.1

Evertyime a controller is generated, an integration test will automatically be generated along with it.

For example, running the following command:

rails generate controller Things

will result in a things_test.rb file being generated in the test/integration folder with the following contents:

require "test_helper"

class ThingsTest < ActionDispatch::IntegrationTest
  # test "the truth" do
  #   assert true
  # end
end

Generating a controller with action names like this

rails generate controller Things action1 action2

will result in a file with the following contents:

require "test_helper"

class ThingsTest < ActionDispatch::IntegrationTest
  test "successfully load action1" do
    get things_action1_url
    assert_response :success
  end

  test "successfully load action2" do
    get things_action2_url
    assert_response :success
  end
end

Rationale

Naming integration tests as controller tests is confusing and obscures their actual purpose, which is to test if various parts of an application integrate successfully.