Sha256: 6a4ee660d04dbb84b98c55fb674d22fa75698d843833b47696a399ebedee33fb

Contents?: true

Size: 1.33 KB

Versions: 24

Compression:

Stored size: 1.33 KB

Contents

var BastionConfig,
    PrefixInterceptor;

describe('PrefixInterceptor', function() {
    beforeEach(module('gettext'));
    beforeEach(module('Bastion'));

    beforeEach(inject(function(_PrefixInterceptor_, _BastionConfig_) {
        PrefixInterceptor = _PrefixInterceptor_;
        BastionConfig = _BastionConfig_;
    }));

    describe('uncached template URL and no relativeUrlRoot', function() {
        it('prepends / to config.url', function() {
            var result = PrefixInterceptor.request({ url: 'template.html'});
            expect(result.url).toBe('/template.html');
        });
    });

    describe('relativeUrlRoot configured', function() {
        beforeEach(function() {
          BastionConfig.relativeUrlRoot = '/foreman/';
        });

        describe('uncached template URL', function() {
            it('prepends the relative URL prefix', function() {
                var result = PrefixInterceptor.request({ url: 'template.html'});
                expect(result.url).toBe('/foreman/template.html');
            });
        });

        describe('non-template URL', function() {
            it('prepends the relative URL prefix', function() {
                var result = PrefixInterceptor.request({ url: 'api/v2/hosts'});
                expect(result.url).toBe('/foreman/api/v2/hosts');
            });
        });
    });
});

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
bastion-6.1.23 test/bastion-config.test.js
bastion-6.1.22 test/bastion-config.test.js
bastion-6.1.21 test/bastion-config.test.js
bastion-6.1.20 test/bastion-config.test.js
bastion-6.1.19 test/bastion-config.test.js
bastion-6.1.18 test/bastion-config.test.js
bastion-6.1.17 test/bastion-config.test.js
bastion-6.1.16 test/bastion-config.test.js
bastion-6.1.15 test/bastion-config.test.js
bastion-6.1.14 test/bastion-config.test.js
bastion-6.1.13 test/bastion-config.test.js
bastion-6.1.12 test/bastion-config.test.js
bastion-6.1.11 test/bastion-config.test.js
bastion-6.1.10 test/bastion-config.test.js
bastion-6.1.9 test/bastion-config.test.js
bastion-6.1.8 test/bastion-config.test.js
bastion-6.1.7 test/bastion-config.test.js
bastion-6.1.6 test/bastion-config.test.js
bastion-6.1.5 test/bastion-config.test.js
bastion-6.1.4 test/bastion-config.test.js