Booleans, Validations, Devise, and TDD

I’ve had this drafted for awhile but I’ve forgotten to post it so here it goes anyways … again.

After finishing our work on databases and Active Record database calls, we’ve switched to working on booleans again, something we covered in the Ruby stage of the bootcamp, only this time it’s getting a bit more elaborate. Devise, validations, and test driven development (TDD) are the heart of what we’ve been working on these past few weeks.

Devise is an authentication tool that authorizes users on your website. In a nutshell it comes prepackaged with a lot of these encryption features, sign in and sign up pages, and the ability to authenticate what users can see and not see on a website. You don’t want your website users to have access to what the admin can see, right?

Active Record Validations are kind of an extension of website security. Basically, these validations are requirements that a designer can use to make sure a user can’t enter “bad” information into the database. For example if you’re setting prices on your website and you enter a word instead of a number you could make sure that the user entry only stores numbers, thus preventing a user from entering anything else. These are essentially ways of stupid-proofing your website.

Test Driven Development is a form of software testing that has you writing short tests before writing the actual program to make sure it is fully functional. Our class is being taught how to write these tests using RSpec, which is a gem that is for writing these tests in Ruby. The TDD process begins by writing a test that fails, then writing code that works with the test, and then refactoring the code so it’s written as efficiently as possible. A more elaborate graphic on the TDD process can be viewed below.

 

TDD_Global_Lifecycle

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s