I found a great way to test my protected attributes while looking around online. like to code my model tests using the stock unit testing libraries. It’s clean and simple and it does everything that I need. So I took the existing rspec code and I converted it into a standard test helper.
Put this in your test_helper.rb file and you’re good to go.
Here’s what a standard unit test looks like now.
1 2 3 | |
Note that you don’t have to instantiate anything now. No mucking about with fixtures or factories.