Skip to content

Instantly share code, notes, and snippets.

@cibernox
Last active March 12, 2017 13:10
Show Gist options
  • Select an option

  • Save cibernox/239f153019bf477a6e944451f022678b to your computer and use it in GitHub Desktop.

Select an option

Save cibernox/239f153019bf477a6e944451f022678b to your computer and use it in GitHub Desktop.
Demo assert regression
import Ember from 'ember';
export default Ember.Component.extend({
init(){
this._super(...arguments);
Ember.assert('{{my-component}} must receive a `foo` action', !!this.get('foo'));
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('my-component', 'Helps the user with assertions', {
integration: true
});
test('it doesn\'t if the `foo` property is given', function(assert) {
assert.expect(0);
this.render(hbs`{{my-component foo="something"}}`);
});
test('it throws if the `foo` property is not given', function(assert) {
assert.expect(1);
assert.throws(function() {
this.render(hbs`{{my-component}}`);
}, /must receive a `foo` action/);
});
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.11.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": true
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.11.3",
"ember-data": "2.11.0",
"ember-template-compiler": "2.11.3",
"ember-testing": "2.11.3"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment