mardi 22 novembre 2016

Rails - How to test enum PostgreSQL data-type with rspec?

I'm using shoulda-matchers to test enum.

describe 'enum' do
  it do
    should define_enum_for(:gender).
    with([:male, :female, :others])
  end
end

Recently, I changed the column at the DB to enum data-type, as showed here

After that, my test fails (obviously) and shows the follow message.

 1) User enum should define :gender as an enum with [:male, :female, :others] and store the value in a column with an integer type

How can I test that with rspec?

Aucun commentaire:

Enregistrer un commentaire