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

Context is not being reset between test runs #110

Closed
Turbo87 opened this issue Nov 26, 2016 · 4 comments
Closed

Context is not being reset between test runs #110

Turbo87 opened this issue Nov 26, 2016 · 4 comments
Labels
Milestone

Comments

@Turbo87
Copy link
Member

Turbo87 commented Nov 26, 2016

  describe('pretty-color integration test', function() {
    setupComponentTest('pretty-color', {
      integration: true
    });

    it('renders with color', function() {
      this.set('name', 'green');
      this.render(Ember.Handlebars.compile(`{{pretty-color name=name}}`));
      expect(Ember.$.trim(this.$().text())).to.equal('Pretty Color: green');
    });

    it('renders a second time without', function() {
      this.render(Ember.Handlebars.compile(`{{pretty-color name=name}}`));
      expect(Ember.$.trim(this.$().text())).to.equal('Pretty Color:');
    });
  });

Expected behavior: the second test should pass since the context on each test is being reset and name should be undefined.

Actual behavior: the name value from the first test bleeds into the second test and results in Pretty Color: green instead.

Thanks to @acburdine for figuring this out! (see TryGhost/Admin#206 (comment))

This seems to have been introduced by v0.9.x, but it not limited to the new testing API.

@Turbo87
Copy link
Member Author

Turbo87 commented Nov 26, 2016

It seems that this was caused by #89 and #91. Reverting those two commits fixes the issue.

/cc @dgeb

@rwjblue
Copy link
Member

rwjblue commented Nov 26, 2016

Heh. This is a mocha design issue.

@Turbo87
Copy link
Member Author

Turbo87 commented Nov 27, 2016

Yes, but one that we can work around if the thing that get/set work on is reset before each test.

@Turbo87
Copy link
Member Author

Turbo87 commented Nov 27, 2016

Fixed by #111

@Turbo87 Turbo87 closed this as completed Nov 27, 2016
@Turbo87 Turbo87 added this to the v0.9.4 milestone Nov 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants