tienyuan/todoapp — pull request #4 by tienyuan (2014-10-06 21:27:47+00:00)
Title: Cleanup code

It took me a while to figure out why my test for completed only being a boolean value was failing.

I originally had
```
describe "ActiveModel validations" do
it { expect(@new_task).to validate_presence_of(:description).with_message( /can't be blank/ ) }
it { expect(@new_task).to allow_value(true).for(:completed) }
it { expect(@new_task).to allow_value(false).for(:completed) }
it { expect(@new_task).to_not allow_value(nil).for(:completed) }
end
```
which resulted in
```
Failures:

1) Task class methods ActiveModel validations should not allow completed to be set to "taco"
Failure/Error: it { expect(@new_task).to_not allow_value('taco').for(:completed) }
Expected errors when completed is set to "taco", got no errors
# ./spec/models/task_spec.rb:53:in `block (4 levels) in '

Finished in 1.37 seconds (files took 4.83 seconds to load)
13 examples, 1 failure
```

Apparently there is no good way to test other than making sure it's an included column
http://robots.thoughtbot.com/shoulda-matchers-2-6-0