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

If ED is being used and integration:true then I should be able to access the store #31

Closed
abuiles opened this issue Mar 27, 2015 · 10 comments

Comments

@abuiles
Copy link
Member

abuiles commented Mar 27, 2015

Currently if we set integration:true the store is not available, I asked @dgeb and he mentioned that we should be able to do this.

@ronco
Copy link

ronco commented Jun 5, 2015

👍

@blimmer
Copy link
Contributor

blimmer commented Jun 5, 2015

I definitely agree with this. It seems a bit backwards that the store is available in a unit test, but not in an integration: true test.

@pgasiorowski
Copy link

This seems to be possible as of 0.5

moduleForComponent('my-comp', {
  integration: true,
  beforeEach: function() {
    this.store = this.registry.lookup('service:store');
  }
}

@elwayman02
Copy link
Contributor

The point is that this shouldn't be necessary, though. It should already be there, @WooDzu

@ef4
Copy link
Contributor

ef4 commented Oct 8, 2015

We have service injection support now. The store is just a service, and I don't think it needs to be special-cased. The following already works in the current release:

moduleForComponent('my-comp', {
  integration: true,
  beforeEach: function() {
    this.inject.service('store');
    this.get('store').createRecord(...);
  }
}

@elwayman02
Copy link
Contributor

@ef4 what if the service is already injected in the component itself rather than via initializer? That doesn't seem to be working...

@ef4
Copy link
Contributor

ef4 commented Oct 9, 2015

I recommend against doing injection in an initializer. Declare in each component exactly which services should be injected, and tests will all work automatically.

If you really need something in an initializer, you'll need to call it yourself. Initializers don't run before integration tests.

@elwayman02
Copy link
Contributor

Right, hence my question, relevant to #109 @ef4...

@ef4
Copy link
Contributor

ef4 commented Oct 9, 2015

Sorry, I misread your earlier comment.

Please provide a reproduction in #109. I have lots of examples of components that do someService: Ember.inject.service() that are working fine in integration tests, so we need more to go on to figure out why yours don't.

@Turbo87
Copy link
Member

Turbo87 commented Oct 14, 2017

closing due to inactivity

@Turbo87 Turbo87 closed this as completed Oct 14, 2017
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

7 participants