This should be a no brainer. I have a Sinatra application with RSpec and, for some reason, my validations are failing with the inclusion
validation.
This is my code:
class Employee < ActiveRecord::Base
validates :department, inclusion: { in: w%(Sales, Finance, Marketing) }
end
This is the spec file:
it 'should save a valid employee' do
employee = Employee.new(name: 'Employee One',
email: 'example@gmail.com',
title: 'Software Engineer',
department: 'Sales')
expect(employee).to be_valid
end
This test fails because the department field is not 'included in the list'. This is aggravating because it fails no matter what field I put. Errors like these are usually from something simple.
What am I missing?