how to make validates inclusion true or false work in testing rails?
i'm using gem shoulda for my testing, if i have some validates like this in my model :
class Draw < ActiveRecord::Base
validates :available, inclusion: { in: [true, false] }
end
how to make this validate work in testing?, when i try this code in my model testing :
require 'test_helper'
class DrawTest < ActiveSupport::TestCase
should ensure_inclusion_of(:available).in_array([true, false])
end
i get error like this :
DrawTest#test_: Draw should ensure inclusion of available in [true, false]. [/home/my_user/.rvm/gems/ruby-2.0.0-p451/gems/shoulda-context-1.2.1/lib/shoulda/context/context.rb:344]:
[true, false] doesn't match array in validation
how to resove this problem?