Rails: especificações para validações de inclusão

atribuição.rb

class Assignment < ActiveRecord::Base
STATUS_OPTIONS
= ['Not Started', 'In Progress', 'Completed']
validates
:status, presence: true, inclusion: STATUS_OPTIONS
end

assign_spec.rb

describe 'status' do
context
'valid entry' do
['Not Started', 'In Progress', 'Completed'].each do |valid_status|

it
"is valid with 'Not Started', 'In Progress', 'Completed'" do
expect
(build(:assignment, status: valid_status)).to be_valid
end
end
end

context
'invalid entry' do
it
"is invalid without 'Not Started', 'In Progress', 'Completed'" do
expect
(build(:assignment, status: 'a')).to_not be_valid
end
end
end