Commit 5bd6e829 by Peter Fogg

Merge pull request #10465 from edx/peter-fogg/fix-spec-helpers-closure

Fix `withData` and `withConfiguration` helpers.
parents b48b2b64 759a3c4f
...@@ -13,9 +13,11 @@ define([], function () { ...@@ -13,9 +13,11 @@ define([], function () {
var withData = function (data, func) { var withData = function (data, func) {
for (var name in data) { for (var name in data) {
if (data.hasOwnProperty(name)) { if (data.hasOwnProperty(name)) {
it(name, function () { (function (name) {
func.apply(this, data[name]); it(name, function () {
}); func.apply(this, data[name]);
});
})(name);
} }
} }
}; };
...@@ -31,12 +33,14 @@ define([], function () { ...@@ -31,12 +33,14 @@ define([], function () {
var withConfiguration = function (config, setup, test) { var withConfiguration = function (config, setup, test) {
for (var name in config) { for (var name in config) {
if (config.hasOwnProperty(name)) { if (config.hasOwnProperty(name)) {
describe(name, function () { (function (name) {
beforeEach(function () { describe(name, function () {
setup.apply(this, config[name]); beforeEach(function () {
setup.apply(this, config[name]);
});
test();
}); });
test(); })(name);
});
} }
} }
}; };
......
...@@ -171,10 +171,11 @@ define([ ...@@ -171,10 +171,11 @@ define([
] ]
}, function (url, expectedEvent) { }, function (url, expectedEvent) {
var teamsTabView = createTeamsTabView(this, { var teamsTabView = createTeamsTabView(this, {
userInfo: TeamSpecHelpers.createMockUserInfo({staff: true}) userInfo: TeamSpecHelpers.createMockUserInfo({staff: true})
}); });
teamsTabView.teamsCollection = TeamSpecHelpers.createMockTeams();
teamsTabView.router.navigate(url, {trigger: true}); teamsTabView.router.navigate(url, {trigger: true});
if (AjaxHelpers.currentRequest(requests)) { if (requests.length > requests.currentIndex) {
AjaxHelpers.respondWithJson(requests, {}); AjaxHelpers.respondWithJson(requests, {});
} }
expect(Logger.log).toHaveBeenCalledWith('edx.team.page_viewed', expectedEvent); expect(Logger.log).toHaveBeenCalledWith('edx.team.page_viewed', expectedEvent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment