Category: rails

ruby-on-rails-min 0

How to run only one test in rspec

Mostly while devel­op­ing its extremely con­ve­nient to be able to run just one par­tic­u­lar describe block or it block. Rspec lets you do that using a com­bi­na­tion of focus: true as well as adding some…

ruby-on-rails-min 0

How to test a private method in rspec

Since you can­not access a pri­vate method directly, in order to test a pri­vate method, you can make use of the ‘send’ method that is avail­able on all objects. @obj = MyClass.new result =…

ruby-on-rails-min 0

Auto update Gemfile when installing ruby gems

npm lets you save a mod­ule into your package.json file using the –save options. You can do the same in ruby, by installing a gem called ‘gem­rat’ and then using that com­mand to install…

ruby-on-rails-min 0

How to check all the rake tasks that are available for use

The rails rake com­mand comes with a num­ber of tasks. This tiny com­mand shows you a list of all the rake tasks avail­able and a short descrip­tion. rake –tasks Ref­er­ence http://stackoverflow.com/questions/10301794/difference-between-rake-dbmigrate-dbreset-and-dbschemaload