2 * Sencha-specific matchers for convenient testing of Model expectations
4 beforeEach(function() {
8 * expect('User').toHaveMany('Product');
10 toHaveMany: function(expected) {
11 if (typeof this.actual == 'string') {
12 this.actual = Ext.ModelManager.types[this.actual].prototype;
15 var associations = this.actual.associations.items,
16 length = associations.length,
19 for (i = 0; i < length; i++) {
20 association = associations[i];
22 if (association.associatedName == expected && association.type == 'hasMany') {
32 * expect('Product').toBelongTo('User')
34 toBelongTo: function(expected) {
35 if (typeof this.actual == 'string') {
36 this.actual = Ext.ModelManager.types[this.actual].prototype;
39 var associations = this.actual.associations.items,
40 length = associations.length,
43 for (i = 0; i < length; i++) {
44 association = associations[i];
46 if (association.associatedName == expected && association.type == 'belongsTo') {