
describe('Entity Forms Validation', function () {
    var formView = Marionette.EntityFormView.extend({
    onRender: function () {
        this.field('name')
            .label('Name')
            .fieldset('user-settings', 'User Settings')
            .required('Please enter your full name.')
            .singleLine();

        this.field('email')
            .label('Email')
            .fieldset('user-settings')
            .required('Please enter an email address.')
            .email('The email address is not in the correct format!')
            .singleLine();

        this.field('age')
            .label('Your Age')
            .fieldset('user-settings')
            .required('Your Age is required!!')
            .numeric('This field should be a number!')
            .min('There is a minimum age of 23 required!', 23)
            .singleLine();
        }
    });
    
    var options = {
        collection: new MockEntityCollection(),
        model: Backbone.Model,
        formView: formView,
        listView: MockListView,
        title: 'Testing',
        route: 'test',
        region: region
    };

    var entityService = new Marionette.EntityService(options);
    entityService.create();
    
    it('returns min requirement error', function () {
        var currentView =  region.currentView;
        
        currentView.$el.find('[data-field=age]').val(21);
        currentView.$el.find('[data-field=name]').val('test');
        currentView.$el.find('[data-field=email]').val('test@example.com');
        
        var errors = currentView.validate();        
        expect(errors[0].error[0]).toEqual('There is a minimum age of 23 required!');
    });
    
    it('returns email requirement error', function () {
        var currentView =  region.currentView;
        
        currentView.$el.find('[data-field=age]').val(23);
        currentView.$el.find('[data-field=name]').val('test');
        currentView.$el.find('[data-field=email]').val('test');
        
        var errors = currentView.validate();        
        expect(errors[0].error[0]).toEqual('The email address is not in the correct format!');
    });
});

@@ -829,16 +829,143 @@
 !', 23)%0A
+            .rule('testRule', 'The age cannot be greater than 50!', function(val)%7B%0A            return val %3C 50;%0A            %7D)%0A
         
@@ -1801,32 +1801,504 @@
 );%0A    %7D);%0A    %0A
+    it('returns custom rule requirement error', function () %7B%0A        var currentView =  region.currentView;%0A        %0A        currentView.$el.find('%5Bdata-field=age%5D').val(51);%0A        currentView.$el.find('%5Bdata-field=name%5D').val('test');%0A        currentView.$el.find('%5Bdata-field=email%5D').val('test@example.com');%0A        %0A        var errors = currentView.validate();        %0A        expect(errors%5B0%5D.error%5B0%5D).toEqual('The age cannot be greater than 50!');%0A    %7D);%0A    %0A
     it('returns 

Update entityFormTests.js