Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing enum? #26

Open
Bartuz opened this issue Oct 4, 2015 · 3 comments
Open

Testing enum? #26

Bartuz opened this issue Oct 4, 2015 · 3 comments

Comments

@Bartuz
Copy link

Bartuz commented Oct 4, 2015

How should I test enum setup in my app?

@thetron
Copy link
Owner

thetron commented Oct 7, 2015

@Bartuz The library is tested - so you don't need to test any of the features that you get from mongoid-enum, so I would just be testing your enums the same way you would test any attribute on your Mongoid documents.

@Bartuz
Copy link
Author

Bartuz commented Oct 7, 2015

Ok, but there are rspec matchers which I can use this way:
it { is_expected.to have_fields(:birthdate, :registered_at).of_type(DateTime) }

there is not anything likee this for this gem, right?

@thetron
Copy link
Owner

thetron commented Oct 7, 2015

No, the library doesn't come with any RSpec matchers, but the fields are (at this point in time) just strings (or symbols - I can't quite remember precisely), so:

it { is expected.to have_fields(:foobar_enum).of_type(String)

Would be adequate here, IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants