Sha256: 7e29ba95e10e8139adcdc3d5e008fe3ab16d962586d3dc353aeb65ff495135ec

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

describe('resource provider factory config', function () {
    'use strict';

    it('should allow disabling root wrapping globally', function () {
        module('rails', function (RailsResourceProvider) {
            expect(RailsResourceProvider.rootWrapping(false)).toBe(RailsResourceProvider);
        });

        inject(function (railsResourceFactory) {
            expect(railsResourceFactory({name: 'test', url: '/test'}).config.rootWrapping).toBe(false);
        });
    });

    it('should allow setting updateMethod globally', function () {
        module('rails', function (RailsResourceProvider) {
            expect(RailsResourceProvider.updateMethod('patch')).toBe(RailsResourceProvider);
        });

        inject(function (railsResourceFactory) {
            expect(railsResourceFactory({name: 'test', url: '/test'}).config.updateMethod).toBe('patch');
        });
    });

    it('should allow setting http headers options globally', function () {
        module('rails', function (RailsResourceProvider) {
            expect(RailsResourceProvider.httpConfig({headers: {'test': "header"}})).toBe(RailsResourceProvider);
        });

        inject(function (railsResourceFactory) {
            expect(railsResourceFactory({name: 'test', url: '/test'}).config.httpConfig.headers).toEqualData({'Accept': 'application/json', 'Content-Type': 'application/json', 'test': 'header'});
        });
    });

    it('should allow setting default query parameters options globally', function () {
        module('rails', function (RailsResourceProvider) {
            expect(RailsResourceProvider.defaultParams({'test': "1"})).toBe(RailsResourceProvider);
        });

        inject(function (railsResourceFactory) {
            expect(railsResourceFactory({name: 'test', url: '/test'}).config.defaultParams).toEqualData({'test': '1'});
        });
    });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
angularjs-rails-resource-1.0.0.pre.2 test/unit/angularjs/rails/resourceProviderSpec.js
angularjs-rails-resource-1.0.0.pre.1 test/unit/angularjs/rails/resourceProviderSpec.js