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

How do I test it? #15

Open
chungwong opened this issue Sep 4, 2018 · 6 comments
Open

How do I test it? #15

chungwong opened this issue Sep 4, 2018 · 6 comments

Comments

@chungwong
Copy link

Say I have the following setup in config/test.exs

config :mailchimp,
  api_key: "your api-us10"

for every test, it is making a real call to Mailchimp. Is there a way to prevent it from sending real requests to Mailchimp?

@klacointe
Copy link
Contributor

@ericdude4
Copy link
Contributor

@chungwong and anyone coming here in the future. The library now uses exvcr for testing. All the fixtures are included in the repo so testing is as easy as git pull mix test

@niklasmoeller
Copy link

@chungwong and anyone coming here in the future. The library now uses exvcr for testing. All the fixtures are included in the repo so testing is as easy as git pull mix test

@ericdude4 but this is only for the internal tests of this package, right? This does not help me, when I use this package in my application and I want to test my integration is working. How would I test this?

@ericdude4
Copy link
Contributor

@niklasmoeller Yes, this is for the internal tests of the package.

If you include this package in your application and write tests, it will make live requests to the Mailchimp API. For this reason, I would recommend using exvcr for your testing as well - unless you want the tests to always make live requests to the Mailchimp API 🤷‍♂

@lessless
Copy link

Another option is to replace Httpoison with Tesla and use provided mock facility.

@niklasmoeller
Copy link

Thanks @ericdude4. I will take a look into exvcr. This could be a good solution for this and other cases, too.

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

5 participants