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

Raise a descriptive error when a required class is missing #634

Merged
merged 1 commit into from
Oct 14, 2016
Merged

Raise a descriptive error when a required class is missing #634

merged 1 commit into from
Oct 14, 2016

Conversation

rbone
Copy link

@rbone rbone commented Oct 13, 2016

Currently when Mockery has been configured not to allow mocking non-existent methods, attempting to mock a non-existent class gives a confusing error. It complains that it can't mock methods that don't exist on the specified class, but actually the error is that mockery can't find the referenced class to mock it and verify the methods it's allowed to mock.

This commit changes that behaviour so that attempting to mock a class that doesn't exist throws an exception that explicitly says that the specified class doesn't exist, however it only does so while mockery is configured not to allow mocking of non-existent methods.

I'm not entirely certain that this is the right way to make this change, so feedback is appreciated. Also appreciated is feedback on if this change is considered desirable; no hard feelings if it's not!

Currently when Mockery has been configured not to allow mocking
non-existent methods, attempting to mock a non-existent class gives a
confusing error. It complains that it can't mock methods that don't
exist on the specified class, but actually the error is that mockery
can't find the referenced class to mock it.

This commit changes that behaviour so that attempting to mock a class
that doesn't exist throws an exception that explicitly says that the
specified class doesn't exist, however it only does so while mockery is
configured not to allow mocking of non-existent methods.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 76.021% when pulling df8d34d on rbone:raise_descriptive_error_on_missing_class into 15dc926 on padraic:master.

@davedevelopment davedevelopment merged commit 900faf0 into mockery:master Oct 14, 2016
@davedevelopment
Copy link
Collaborator

Good enough for me, thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants