Skip to content

Commit

Permalink
tests(specs): fix tests that break in the ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrowhurstram committed Aug 16, 2015
1 parent fc2fa18 commit fb7c22d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 33 deletions.
10 changes: 3 additions & 7 deletions test/filtersSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ describe('ngTableFilterConfig', function () {
var ngTableFilterConfig,
ngTableFilterConfigProvider;

beforeEach(function () {
// Initialize the service provider
// by injecting it to a fake module's config block
var fakeModule = angular.module('test.config', function () {});
fakeModule.config( function (_ngTableFilterConfigProvider_) {
beforeEach(module("ngTable"));
beforeEach(function(){
module(function(_ngTableFilterConfigProvider_){
ngTableFilterConfigProvider = _ngTableFilterConfigProvider_;
ngTableFilterConfigProvider.resetConfigs();
});
// Initialize test.app injector
module('ngTable', 'test.config');
});

beforeEach(inject(function (_ngTableFilterConfig_) {
Expand Down
24 changes: 8 additions & 16 deletions test/ngTableDefaultGetDataSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ describe('ngTableDefaultGetData', function () {
describe('provider', function () {
var ngTableDefaultGetDataProvider;

beforeEach(function () {
// grab a reference to the service provider
// by injecting it to a fake module's config block
var fakeModule = angular.module('test.config', function () {});
fakeModule.config(function (_ngTableDefaultGetDataProvider_) {
ngTableDefaultGetDataProvider = _ngTableDefaultGetDataProvider_;
beforeEach(module("ngTable"));
beforeEach(function(){
module(function(_ngTableDefaultGetDataProvider_){
ngTableDefaultGetDataProvider=_ngTableDefaultGetDataProvider_;
});
// Initialize test.app injector
module('ngTable', 'test.config');
// ensure the config block runs
inject(function(_ngTableDefaultGetData_){ });
});
beforeEach(inject());

it('should be configured to use built-in angular filters', function () {
expect(ngTableDefaultGetDataProvider.filterFilterName).toBe('filter');
Expand Down Expand Up @@ -246,13 +241,10 @@ describe('ngTableDefaultGetData', function () {
var ngTableDefaultGetData, tableParams;

beforeEach(function () {
// grab a reference to the service provider
// by injecting it to a fake module's config block
var fakeModule = angular.module('custom.filters', function () {
// add a custom filter available to our tests
module('ngTable', function($provide){
$provide.factory('myCustomFilterFilter', myCustomFilter)
});
fakeModule.filter('myCustomFilter', myCustomFilter);
// Initialize test.app injector
module('ngTable', 'custom.filters');

myCustomFilter.$inject = [];
function myCustomFilter() {
Expand Down
13 changes: 3 additions & 10 deletions test/tableParamsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ describe('NgTableParams', function () {
var NgTableParams,
$rootScope;


beforeEach(function () {
// Initialize the service provider
// by injecting it to a fake module's config block
var fakeModule = angular.module('test.config', function () {});
fakeModule.config( function ($provide) {
beforeEach(module("ngTable"));
beforeEach(function(){
module(function($provide){
$provide.decorator('ngTableDefaultGetData', createSpy);


Expand All @@ -35,12 +32,8 @@ describe('NgTableParams', function () {
return jasmine.createSpy('ngTableDefaultGetDataSpy',ngTableDefaultGetData).and.callThrough();
}
});
// Initialize test.app injector
module('ngTable', 'test.config');

});


beforeEach(inject(function ($controller, _$rootScope_, _NgTableParams_) {
$rootScope = _$rootScope_;
scope = $rootScope.$new();
Expand Down

0 comments on commit fb7c22d

Please sign in to comment.