# Integration tests with model-specific routes

**URL:** <https://discuss.emberjs.com/t/integration-tests-with-model-specific-routes/7044>\
**Category:** Testing\
**Created:** [January 8, 2015, 1:18am UTC](https://discuss.emberjs.com/t/integration-tests-with-model-specific-routes/7044 "2015-01-08T01:18:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jme783](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/jme783/32/9703_2.png) [@jme783](https://discuss.emberjs.com/u/jme783)\
**Post date:** [January 8, 2015, 1:18am UTC](https://discuss.emberjs.com/t/integration-tests-with-model-specific-routes/7044/1 "2015-01-08T01:18:49Z")

</div>

Hey all! Had an interesting issue I’m running into when trying to create integration tests for my application, specifically when trying to use `visit()`. My situation is this: this ember app requires that I have “friendly,” readable URLs that correspond to models currently available to my ember application. For instance, instead of having a URL be `/organizations/[id]`, I’m mapping the URL to the name of the organization as `/:orgname`. To illustrate, here’s the relevant code from my `organization` route:

```auto
import Ember from "ember";

var OrganizationRoute = Ember.Route.extend({
  model: function(params) {
    // Attach the organization slug to the Ember object for use in the product route
    Ember.organizationSlug = params.organization_slug;
    return this.store.find('organization', {slug: params.organization_slug});
  },
  ...
});

export default OrganizationRoute;

```

This makes unit testing a bit difficult as when I call `visit('URL goes here')`, tests will only pass if I send the test to a URL a valid model that has been created and saved. I don’t want my integration tests to be dependent on the dynamic and surely changing data it will receive from a REST API.

My first thought was to create an `organization` in the integration test, but that doesn’t seem to be working as `var store = this.store();` inside of an integration test (in Ember CLI) is returning undefined. Has anyone run into this before? How did you handle it?

Many thanks,

Jeff
