# Best way to test validates\_acceptance\_of

**URL:** <https://www.ruby-forum.com/t/best-way-to-test-validates-acceptance-of/206674>\
**Category:** RSpec\
**Created:** [May 7, 2011, 3:01am UTC](https://www.ruby-forum.com/t/best-way-to-test-validates-acceptance-of/206674 "2011-05-07T03:01:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 7, 2011, 3:01am UTC](https://www.ruby-forum.com/t/best-way-to-test-validates-acceptance-of/206674/1 "2011-05-07T03:01:21Z")

</div>

Hello,

I am trying to write a test to make sure that the property  
validates\_acceptance\_of is present on a model. In my exploration, I  
can’t  
seem to make a test that fails when this property is absent, then passes  
when added.

Any guidance would be appreciated!

~Erik L.

---

<div class="post-metadata">

**Author:** ![Erik\_Lindblom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/13edae/32.png) [@Erik\_Lindblom](https://www.ruby-forum.com/u/Erik_Lindblom)\
**Post date:** [May 7, 2011, 4:31pm UTC](https://www.ruby-forum.com/t/best-way-to-test-validates-acceptance-of/206674/2 "2011-05-07T16:31:43Z")

</div>

On May 4, 2011, at 1:24 PM, Erik Lindblom wrote:

> Hello,
> 
> I am trying to write a test to make sure that the property  
> validates\_acceptance\_of is present on a model. In my exploration, I can’t seem to  
> make a test that fails when this property is absent, then passes when added.
> 
> Any guidance would be appreciated!

Per  
[http://stackoverflow.com/questions/5886961/best-way-to-test-validates-acceptance-of-with-rspec](http://stackoverflow.com/questions/5886961/best-way-to-test-validates-acceptance-of-with-rspec)

# Gemfile

gem ‘shoulda’, :group =\> :test

# thing\_spec.rb

require ‘spec\_helper’

describe Thing do  
it { should validate\_acceptance\_of(:tos) }  
end
