File: validates_acceptance_of_test.rb

package info (click to toggle)
ruby-validatable 1.6.7-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 284 kB
  • sloc: ruby: 1,636; makefile: 10
file content (16 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

module Functional
  class ValidatesAcceptanceOfTest < Test::Unit::TestCase
    test "given no acceptance, when validated, then error is in the objects error collection" do
      klass = Class.new do
        include Validatable
        attr_accessor :name
        validates_acceptance_of :name
      end
      instance = klass.new
      instance.valid?
      assert_equal "must be accepted", instance.errors.on(:name)
    end
  end
end