[RUBY] The story when the test folder was not created in Rails

The story when the test folder was not created in Rails


Recently, for some reason, I started studying Ruby on Rails. I would like to talk about the issue that occurred there. As anyone who uses Rails or is studying knows, Rails comes with a test function as standard. It is the one that is automatically created when you create a controller or model. When I was doing a Rails tutorial as a Rails study, there was an incident where it wasn't created. Rails generate controller at the beginning of the tutorial It was when the controller was created with the controller name and action name. I wondered why the test was running on rails t. Make a note of the solution you found at that time.


In config/application.rb in the project

require "rails/test_unit/railtie"

After adding, the test folder was created successfully. Once to try

rails destroy controller controller name action name

Delete with and then again

rails g controller controller name action name

When created with

/myapp # rails g controller Index home help
Running via Spring preloader in process 556
      create  app/controllers/index_controller.rb
       route  get 'index/home'
get 'index/help'
      invoke  erb
      create    app/views/index
      create    app/views/index/home.html.erb
      create    app/views/index/help.html.erb
      invoke  test_unit
      create    test/controllers/index_controller_test.rb <-this
      invoke  helper
      create    app/helpers/index_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    scss
      create      app/assets/stylesheets/index.scss

It was created!

By the way

require 'rails/all'

Those who have become should be okay.


I used a different version of Rails from the tutorial, and I built the environment with Docker, so it seems that it did not come to the expected state. I've been googled for ways to solve this problem, but aren't there many people who have the same experience? it seems like. But I learned Rails! It seems that many other settings can be made in application.rb. For example, whether to allow the creation of stylesheets and helpers when generating ... For more information, you may want to read "Set up config.generators first after rails new" (https://qiita.com/yuutetu/items/135b1c8ab512208aebfe).


ruby 2.6.5 Rails 6.1.0

Recommended Posts

The story when the test folder was not created in Rails
The story of stopping because the rails test could not be done
Rails refactoring story learned in the field
[Rails] The cause of not being able to post was in form_with
When the project is not displayed in eclipse
What to do when rails db: seed does not reflect in the database
A troublesome story when deleting the gems file created in the gem development directory.
[Ruby on Rails Tutorial] Error in the test in Chapter 3
When the server does not start with rails s
Fixed the phenomenon that vuetify built in Rails is not loaded when page transition is done
How to solve the problem when the value is not sent when the form is disabled in rails and sent
A story I was addicted to in Rails validation settings
[Rails] When the layout change of devise is not reflected
What to do when Rails on Docker does not reflect controller changes in the browser
The story I was addicted to when setting up STS
Check the behavior when the exception specified by expected in JUnit 4 @Test annotation occurs / does not occur
What to do if the app is not created with the latest Rails version installed when rails new
[Rails / Routing] How to refer to the controller in the directory you created
[Gradle] The story that the class file did not exist in the jar file
What to do when the changes in the Servlet are not reflected
Breakpoint doesn't work when running Rails Minitest in Ruby Test Explorer
When log data accumulates in Rails and the environment stops working
The story that the build error did not stop when using Eclipse 2020
How to write the view when Vue is introduced in Rails?
[Rails] What was the error message?
About the symbol <%%> in Rails erb
[Rails5] Rspec -Unit test when nesting-
Disable display when not logged in
Data is not registered in Rails.
Correspond to "error that basic authentication does not pass" in the test code "The story that could not be done"
[RSpec] When you want to use the instance variable of the controller in the test [assigns is not recommended]
I examined the file created when selecting Empty Activity in Android Studio
[Rails] I was addicted to the nginx settings when using Action Cable.
A story I was addicted to when testing the API using MockMVC
[Java] The story that the expected array was not obtained by the String.split method.
"" Application.js "is not present in the asset pipeline" error in Ruby on Rails
[Rails] About the error that the image is not displayed in the production environment
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
How to constrain the action of the transition destination when not logged in
The story that the Servlet could not be loaded in the Java Web application
[Cloud9] Yay! You ’re on Rails! Is not displayed in the rails tutorial
In WSL2, when I did `docker-compose up`, I got an error saying that the sh file was not found.
How to resolve the error'ActionView :: Template :: Error (The asset "application.css" is not present in the asset pipeline.'" When precompiling Rails assets
[Rails] Annotate is not executed when migrating
With EqualsVerifier, the equals () test was instant
The identity of params [: id] in rails
JavaScript (vanilla) does not respond in Rails.
Precautions when specifying the URL in render
must not return in the for statement
The story of AppClip support in Anyca
[Rails] [Memo] When to add = to <%%> and when not
I was addicted to the Spring-Batch test
Do not return when memoizing in Ruby
The story of writing Java in Emacs
[Rails] Reset the database in the production environment
Rails6: Extract the image in Action Text
Story when migration could not be done
[NetBeans] Story when it does not start
[Ruby on Rails] Solving the addiction when setting crontab using whenever in EC2
When composer install/require in the Docker container, it becomes `Could not find package`
How to resolve errors that occur in the "Ruby on Rails" integration test