To be honest, I don’t think there is the best and the worst way. Some developers prefer extreme programming by firstly writing tests and then the actual code, some do quite the opposite. If you are unsure where to start, I’d firstly write the code and then proceed to the tests.
By the way, one the best books I’ve read on testing is Rails 4 Test Prescriptions and if you haven’t seen it, I’d really recommend grabbing one. It provides nice examples and thorough explanations.
@James_Hibbard If you’re just practicing I’d say write your own auth. Devise gets complicated really quickly, and cancancan (or Pundit) can be easily written as well.
e.g. old but relevant railscasts com/episodes/385-authorization-from-scratch-part-1 railscasts com/episodes/386-authorization-from-scratch-part-2 https://github.com/railscasts/385-authorization-from-scratch-part-1 github com/railscasts/386-authorization-from-scratch-part-2
To be honest, I don’t think there is the best and the worst way. Some developers prefer extreme programming by firstly writing tests and then the actual code, some do quite the opposite. If you are unsure where to start, I’d firstly write the code and then proceed to the tests.
By the way, one the best books I’ve read on testing is Rails 4 Test Prescriptions and if you haven’t seen it, I’d really recommend grabbing one. It provides nice examples and thorough explanations.
As Benjamin said previously, it is best to start writing authentication system from scratch. Start with something small, simple. When I firstly began using Rails, I was overwhelmed by the amount of things that were done for me and pretty much got lost. I then proceeded step-by-step to really understand what’s going on. The same might happen when using solution like Devise - you’ll probably have hard times understanding how this works together.
I am not a huge fan of extreme programming, probably because in my country people are really rushing for the result. This way I constantly have to write or re-write the code really fast; coding the tests prior to it would take lots of time. So I’d probably proceed to tests after some coding is done, when I have some working piece of the application. Still, I don’t say that this is the preferred way.
I did. We used AngularJS to code the front-end. As far as I know there is a book about integrating AngularJS and Rails, but I personally haven’t read it so can’t give any feedback.
Thank you all for joining us in today’s chat on Rails authentication. A very big thanks to @bodrovis especially for coming in and sharing his insight into Rails.