module ThoughtBot::Shoulda::ActiveRecord::Macros

def should_require_acceptance_of(*attributes)


should_require_acceptance_of :eula
Example:

Regexp or string. Default = I18n.translate('activerecord.errors.messages.accepted')
* :message - value the test expects to find in errors.on(:attribute).
Options:

create a new instance to test against.
model being tested, then this method will use that. Otherwise, it will
If an instance variable has been created in the setup named after the

Ensures that the model cannot be saved if one of the attributes listed is not accepted.
def should_require_acceptance_of(*attributes)
  message = get_options!(attributes, :message)
  message ||= default_error_message(:accepted)
  klass = model_class
  attributes.each do |attribute|
    should "require #{attribute} to be accepted" do
      assert_bad_value(klass, attribute, false, message)
    end
  end
end