Unit tests

Ok, one of my favorite subjects:  Testing.

I'm a huge fan of TDD -- of orthodox TDD.  Of writing a simple test and writing a simple bit of production code to pass, then repeating until I have a system I trust.

Rails has never been friendly to that sort of TDD.  I don't want to go into a long diatribe, but the traditional way of testing things in Rails by running requests through the page lifecycle and verifying the HTML results at the end don't hold up over time.  They're fine with the scaffolded Rails code, but when you get users into a system and the owners want changes, it's really hard to get into the guts of the code and test a fine detail.

Most of my testing is like I do below.  I use plain ol' unit testing, verifying the code that I write.  My tests don't cover if the routing binds to the action, or if the view is accurate, or even if the filters are set up on the controller.  But they do test the code that I'm writing, and I can use the TDD pain to keep my code clean and concise.

To run these tests, ```bundle install``` and then run this command from the project root.

```
bundle exec ruby spec/app/controllers/mgmt_controller_spec.rb
```

I'm using Minitest, just to show that the "bare bones" library still allows for very rspec-like tests.  I also use Mocha, which is a great mocking library.  I also created a /spec folder in the project to keep these entirely separate from the others you're working on.  

For fair contrast, compare these tests to the other ones here: https://github.com/nerdbeers/nerdbeers/blob/f20e40e06912a8a0549b58065f9837bf5d2a2328/test/controllers/suggestion_controller_test.rb

Again, I'm not submitting this in hopes of you  merging it... I just want to offer it as an idea.  Pass along any questions or hate!
Oh, note one more thing:  

**I'm testing against the database!!!**

Again, this code should probably not be in the controller... but it is.  And when we get to the final updating of the data, I'm not against verifying the results through the actual persistence mechanism.  Especially when using something as complicated as an Active Record update.

The neat thing about this is that if you change the way the update is made, it will still work.  This test verifies the result, not the method used to achieve it.  This is unlike the queries I'm running, which I think are much easier with fakes and mocks.