Rails command line cheat sheet| Some useful command for testing and console shadbox Blog

Total Blog Views: 47

Blog Status: publish

Created By: swazahmad Created at: 07-14-2021

Tags:

Server and console:

$rails server or rails s 

Use if you want to access your application through a web browser. If it is local the direction usually is:

http://localhost:3000

$rails console or rails c 
Lets you interact with your Rails application from the command line in the development environment.

$rails console --sandbox 

Use it when you wish to test out some code without changing any data, any change will disappear when you quit.

$reload!

Use it if you changed some source code and want those changes reflected in the console without having to restart.

Testing:

$rails test or rails t

Run our test suite to verify if our test passes or not.

$rails generate integration_test site layout

Integration tests are used to test how various parts of your

application interact. Here we are creating an integration test

named "site_layout.test.rb" inside the "test/integration" folder.

$rails test: integration

Only runs a specific section of tests, in this case, it will only run

the integration tests.

$rails/rake routes

Routes:

To get a complete list of the available routes in your application.


swazahmad

Swaz is Practice Lead of ROR Developer. he's a Blogger, Mentor, and Rubyst. He has expertise in Javascript also . he's highly skilled in designing, developing and testing web applications. He enjoys being challenged and interesting with projects that need him to



Comments



  • swazahmad | almost 4 years ago
    Awesome Information Thanks For Sharing
Buy traffic for your website

About Shadbox

we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.

Services

Downloads