Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove config.set() call to avoid race #8123

Merged
merged 1 commit into from
Aug 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@ import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logsta

let $parentScope;
let $scope;
let config;
let hits;
let indexPattern;
let indexPatternList;
let shortDotsValue;

// Sets up the directive, take an element, and a list of properties to attach to the parent scope.
const init = function ($elem, props) {
ngMock.inject(function ($rootScope, $compile, $timeout, _config_) {
shortDotsValue = _config_.get('shortDots:enable');
config = _config_;
config.set('shortDots:enable', false);
ngMock.inject(function ($rootScope, $compile, $timeout) {
$parentScope = $rootScope;
_.assign($parentScope, props);
$compile($elem)($parentScope);
Expand All @@ -39,7 +34,6 @@ const init = function ($elem, props) {
const destroy = function () {
$scope.$destroy();
$parentScope.$destroy();
config.set('shortDots:enable', shortDotsValue);
};

describe('discover field chooser directives', function () {
Expand All @@ -56,7 +50,21 @@ describe('discover field chooser directives', function () {
'</disc-field-chooser>'
);

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.module('kibana', ($provide) => {
$provide.decorator('config', ($delegate) => {
// disable shortDots for these tests
$delegate.get = _.wrap($delegate.get, function (origGet, name) {
if (name === 'shortDots:enable') {
return false;
} else {
return origGet.call(this, name);
}
});

return $delegate;
});
}));

beforeEach(ngMock.inject(function (Private) {
hits = Private(FixturesHitsProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Expand Down