Refactor tests to not send actual requests #48

Closed
theycallmeswift opened this Issue Dec 27, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

theycallmeswift commented Dec 27, 2012

There is really no need for us to send out actual requests in the tests. In the current format, you would have to manually open and check somewhere in the neighborhood of 40 emails. We can eliminate a lot of this overhead by mocking out the server and checking that the requests are made and in the format that SendGrid expects us to have.

This is labeled as urgent because the TravisCI build is broken until it is fixed and it's blocking a number of pending pull requests.

@theycallmeswift theycallmeswift added a commit that referenced this issue Dec 28, 2012

@theycallmeswift theycallmeswift Moved integration tests into skipped category
This is part of the larger issue #48.  In order to get a passing
TravisCI build, I moved all the integration tests into a skipped
category.  They can now be run with `npm run-script skipped`.
bd963aa

@theycallmeswift theycallmeswift added a commit that referenced this issue Dec 28, 2012

@theycallmeswift theycallmeswift Moved integration tests into skipped category
This is part of the larger issue #48.  In order to get a passing
TravisCI build, I moved all the integration tests into a skipped
category.  They can now be run with `npm run-script skipped`.

Closes #50
3fa2615

@theycallmeswift theycallmeswift added a commit that referenced this issue Dec 28, 2012

@theycallmeswift theycallmeswift Moved WebAPI tests to mocks instead of real requests.
Original integration tests sent out actual emails using credentials from
a config file.  Now they use a mocked http request to SendGrid and we
test that the request is what we would expect.

This is part of #48
b87315f

@theycallmeswift theycallmeswift added a commit that referenced this issue Mar 25, 2013

@theycallmeswift theycallmeswift Moved WebAPI tests to mocks instead of real requests.
Original integration tests sent out actual emails using credentials from
a config file.  Now they use a mocked http request to SendGrid and we
test that the request is what we would expect.

This is part of #48

Closes #49
8f8cfc5
Contributor

motdotla commented Jul 18, 2013

This is actually completed already before I jumped in. Closing.

Additional note: commenting out SMTP = "STUB"; will allow the smtp tests at the very least to run for real.

motdotla closed this Jul 18, 2013

Contributor

theycallmeswift commented Jul 18, 2013

I talked with Pedro (the author of nock) briefly about how to handle the SMTP stub stuff. His advice was just to stub the underlying sendMail function and to check that the parameters are what we would expect.

Contributor

motdotla commented Jul 19, 2013

Ok, good call. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment