Last active
August 29, 2015 14:13
-
-
Save marcioj/0db19a1ad757f4a8c0cb to your computer and use it in GitHub Desktop.
Enum with brazilian states using enumerize gem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pt-BR: | |
| enumerize: | |
| defaults: | |
| state: | |
| ac: Acre | |
| al: Alagoas | |
| ap: Amapá | |
| am: Amazonas | |
| ba: Bahia | |
| ce: Ceará | |
| df: Distrito Federal | |
| es: Espírito Santo | |
| go: Goiás | |
| ma: Maranhão | |
| mt: Mato Grosso | |
| ms: Mato Grosso do Sul | |
| mg: Minas Gerais | |
| pa: Pará | |
| pb: Paraíba | |
| pr: Paraná | |
| pe: Pernambuco | |
| pi: Piauí | |
| rj: Rio de Janeiro | |
| rn: Rio Grande do Norte | |
| rs: Rio Grande do Sul | |
| ro: Rondônia | |
| rr: Roraima | |
| sc: Santa Catarina | |
| sp: São Paulo | |
| se: Sergipe | |
| to: Tocantins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User | |
| enumerize :state, in: [:ac, :al, :ap, :am, :ba, :ce, :df, :es, :go, :ma, :mt, :ms, :mg, :pa, :pb, | |
| :pr, :pe, :pi, :rj, :rn, :rs, :ro, :rr, :sc, :sp, :se, :to] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rails_helper' | |
| RSpec.describe User, type: :model do | |
| describe "enums" do | |
| it { is_expected.to enumerize(:state).in(:ac, :al, :ap, :am, :ba, :ce, :df, :es, :go, :ma, :mt, :ms, :mg, :pa, :pb, :pr, :pe, :pi, :rj, :rn, :rs, :ro, :rr, :sc, :sp, :se, :to) } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment