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

Creating a state service in an integration test requires a lot of boilerplate #45

Open
blimmer opened this issue Nov 25, 2015 · 0 comments

Comments

@blimmer
Copy link
Contributor

blimmer commented Nov 25, 2015

I have integration tests that get passed a state service, and it's a bit of a pain to set up because of the requirement to pass a string to the stateFor method.

For instance, I have a component x-foo and it renders x-bar in its template. Since x-foo creates the state object, x-bar gets passed the state component. In tests/integration/component/x-bar-test.js, I have to create the state service like this:

beforeEach(function() {
  const obj = Ember.Object.extend({
     initialStateObject: Ember.computed(function(){
        ... logic ...
     }),
     state: state('state', 'initialStateObject')
  }).create();

  this.set('stateObj', obj.get('state'));
});

it('does something', function() {
   this.render(hbs`{{x-bar stateObj=stateObj}}`);
   ... assertations ...
});
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

1 participant