heroku / heroku.rb

DEPRECATED! Official Heroku Ruby Legacy API wrapper
161 stars 41 forks source link

Default mocking breaks integration tests #52

Open clemenshelm opened 11 years ago

clemenshelm commented 11 years ago

I just updated to version 0.3.9 of your gem and after a debugging session I finally discovered that from now on you mock requests when running tests.

Could you at least output a warning saying that requests are mocked? It was really hard for me to figure out what’s actually happening.

In my opinion even better would be to make mocking optional. It shouldn’t be a problem for anyone to define that behavior in their spec_helper.rb or wherever they need it.

Thanks a lot!

geemus commented 11 years ago

@clemenshelm - hmm. My expectation is definitely that you would still have to opt-in to mocking, generally by passing :mock => true to the initializer. I'm fairly certain others are using this version also and I haven't had any other reports that indicate what you have mentioned. Is it possible that mock is being set somewhere in your code? It could also be set by Excon.defaults[:mock] = true, so that might also be worth looking for. Thanks!

clemenshelm commented 11 years ago

@geemus No, not that I know. Actually your readme even says:

To run tests, first set ENV['HEROKU_API_KEY'] to your api key. Then use bundle exec rake to run mock tests or MOCK=false bundle exec rake to run integration tests.

geemus commented 11 years ago

@clemenshelm - true, that is just meant to be for running the tests of this project itself though (not projects that include this). Similar to your earlier suggestion, this behavior is caused by our test_helper here: https://github.com/heroku/heroku.rb/blob/master/test/test_helper.rb#L9

clemenshelm commented 11 years ago

Ok, thanks for the info! I’m still not sure what’s causing this, the problem just appeared when I updated from 0.3.8 to 0.3.9. For now I worked around it by instantiating the client like Heroku::API.new(api_key: key, mock: false). But I will look into it again.

geemus commented 11 years ago

@clemenshelm - do let me know if you find it. A bug on my end is certainly possible, but I definitely didn't make it mock-by-default on purpose.