xolvio / meteor-rtd-example-project

A template project to use for creating a meteor app with unit and webdriver testing
91 stars 27 forks source link

Would be more useful if it could mock all meteor objects/functions #1

Closed tianshuo closed 11 years ago

tianshuo commented 11 years ago

Including all those mentioned on http://docs.meteor.com

xolvio commented 11 years ago

Thanks for the input. We're hoping to eventually have everything stubbed, and the approach we're taking is to mock things as they are needed. Was there something in specific you're after?

Sam

tianshuo commented 11 years ago

Definitely accounts, user, password, allow/deny. Also I found that all collection methods are empty functions. Maybe these need to mocked up too, since I'm will need to set user roles, and test security/permissions.

xolvio commented 11 years ago

There's definitely going to be some challenges in those, but nothing that a few brains can't solve :)

So the stub is not intended to mock behaviour, but rather to expose the units of code that Meteor otherwise hides and makes inaccessible. If you want to mock, you can easily do that now using spies. The functions are empty because spies need the methods to exist before they can allow mocking. I'm not sure if you've seen this: Jasmine spies (https://github.com/pivotal/jasmine/wiki/Spies).

If you want to test that you've configured Meteor correctly, such as the integration of packages etc, you'll want to consider running the app in meteor and using PhantomJS. I've recently added support for this and I'll post a new blog about it soon.

xolvio commented 11 years ago

There's a lot more in the stub now. I'm closing this issue until specific scenarios come up. Thanks