I am following this tutorial. In listing 1.1, it states:
Be aware that we’ll be using Rspec as the testing suite, so just make sure you include the -T option when creating the rails application.
What does the -T
option do in this case?
The syntax starts with the rails keyword “rails”. The keyword “rails” ensure to denote that the specific operation is a rails based operation. Hence the rails command executor will be triggered in the background. The command executor follows that the operation is a “ new “ creation operation. . Following this has to be the Application Name value.
By default, every Rails application has three environments: development, test, and production. Each environment's configuration can be modified similarly. In this case, we can modify our test environment by changing the options found in config/environments/test.rb. Your tests are run under RAILS_ENV=test.
To see your application in action, open a browser window and navigate to http://localhost:3000. You should see the Rails default information page: When you want to stop the web server, hit Ctrl+C in the terminal window where it's running.
Most of the work in this tutorial will happen in the app folder, but here's a basic rundown on the function of each of the files and folders that Rails creates by default: Contains the controllers, models, views, helpers, mailers, channels, jobs, and assets for your application.
If you type:
rails -h
You'll see it explains the -T
option like so:
-T, [--skip-test-unit], [--no-skip-test-unit] # Skip Test::Unit files
In other words, this command tells Rails to skip the generation of Test::Unit
files and folders. (Test::Unit
is the default Rails testing framework.)
Without the -T
option, two things happen by default:
The rails app is intialized with a test
directory containing:
test/controllers
test/fixtures
test/helpers
test/integration
test/mailers
test/models
test_helper.rb
You won't need these directories or the test_helper because you'll be using RSpec, which has it's own folder structure and helpers.
Test::Unit
test cases are auto-generated whenever you generate a model, controller, scaffold, etc.
This is also unneeded because once you install RSpec, you'll be using RSpec's automatic spec generators.
Hope that helps!
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