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

Enable ability to mock endpoints in development mode #6714

Merged
merged 1 commit into from Apr 14, 2016

Conversation

kevinansfield
Copy link
Contributor

no issue

  • moves existing mirage config into the testConfig() function to retain full mocks during testing
  • configure mirage to passthrough all requests when in development mode

Our existing mirage config that we use for testing was set up as the default/development config which meant that we had to explicitly disable it when in development mode - this has the unfortunate side-effect of removing the ability mock endpoints when developing new features.

This PR moves everything we currently have into the "test" config and sets up a new mirage development config where endpoints can be overridden with mocks and any requests that aren't handled by a mock will be passed through to the real API.

@@ -33,7 +33,7 @@ module.exports = function (environment) {
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV['ember-cli-mirage'] = {
enabled: false
enabled: true

This comment was marked as abuse.

This comment was marked as abuse.

@jaswilli
Copy link
Contributor

I don't love the idea of this being turned on by default in development mode. It seems like a potential source of headaches because we're now subject to bugs and/or strange behavior in this dependency.

Also, having this on by default opens us up to all sorts of "oops, this was being mocked in development and we just released to production" defects.

Putting the configuration in place so that it can be turned on for local development seems reasonable but always having it on makes me uneasy.

@kevinansfield
Copy link
Contributor Author

Good points, this was cherry-picked over from a branch where I needed to get this working so the default-on was left in. I'll update to keep mirage disabled in development but leave the setup as-is here so that it's easy to enable when required.

no issue
- moves existing mirage config into the `testConfig()` function to retain full mocks during testing
- configure mirage to passthrough all requests when in development mode
@ErisDS ErisDS merged commit 999f7d4 into TryGhost:master Apr 14, 2016
@ErisDS ErisDS deleted the allow-mocked-endpoints-in-dev branch April 14, 2016 18:12
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

4 participants