I have this validation in my model violin.rb
:
validates :bow_included, presence: true
validates_inclusion_of :bow_included, in: [true, false]
And in my spec file violin_spec.rb
I have the following (I use shoulda_matchers
gem):
it { should validate_presence_of :bow_included }
it { should validate_inclusion_of(:bow_included).in_array([true, false]) }
When I run the test, I get this:
1) Violin validations should ensure inclusion of bow_included in [true, false]
Failure/Error: it { should validate_inclusion_of(:bow_included).in_array([true, false]) } [true, false] doesn't match array in validation # ./spec/models/violin_spec.rb:17:in `block (3 levels) in <top (required)>'
However, I have the same validation and test in another model and there it works fine.
Could you please help me find out what's going on here?