Skip to content

Commit

Permalink
add html runner
Browse files Browse the repository at this point in the history
  • Loading branch information
pMedeiros authored and pMedeiros committed Aug 26, 2015
1 parent 9ef2be3 commit 94f14fd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 20 deletions.
19 changes: 15 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ gulp.task('build-specs', ['templatecache'], function () {
log('Building the spec runner');

var options = config.getDefaultWiredepOptions();
options.devDependencies = true;

return gulp
.src(config.specRunner)
Expand All @@ -304,6 +305,12 @@ gulp.task('build-specs', ['templatecache'], function () {
.pipe(gulp.dest(config.client));
});

gulp.task('serve-specs', ['build-specs'], function (cb) {
log('Running the spec runner');
serve(true, true);
cb();
});

/*
* Generic methods
*/
Expand Down Expand Up @@ -338,7 +345,7 @@ function startTests(singleRun, cb) {
}
}

function serve(isDev) {
function serve(isDev, specRunner) {

var nodeOptions = {
script: config.nodeServer,
Expand All @@ -363,7 +370,7 @@ function serve(isDev) {
})
.on('start', function () {
log('*** nodemon started');
startBrowserSync(isDev);
startBrowserSync(isDev, specRunner);
})
.on('crash', function () {
log('*** nodemon crached');
Expand All @@ -389,7 +396,7 @@ function notify(options) {
notifier.notify(notifyOptions);
}

function startBrowserSync(isDev) {
function startBrowserSync(isDev, specRunner) {
if (args.nosync || browserSync.active) {
return;
}
Expand Down Expand Up @@ -448,10 +455,14 @@ function startBrowserSync(isDev) {
notify: true,
reloadDelay: 1000,
/*browser: [win->'chrome', mac->'google chrome'],*/
browser: ['chrome'],
browser: ['google chrome'],
open: true
};

if (specRunner) {
options.startPath = config.specRunnerFile;
}

browserSync(options);
}

Expand Down
18 changes: 9 additions & 9 deletions src/client/app/customers/customers.controller.spec.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
/* jshint -W117, -W030 */
describe('app.customers', function() {
describe('app.customers', function () {
var controller;
var customers = mockData.getMockCustomers();

beforeEach(function() {
beforeEach(function () {
bard.appModule('app.customers');
bard.inject('$controller', '$log', '$q', '$rootScope', 'dataservice');
bard.inject('$controller', '$log', '$q', '$rootScope', 'dataservice');
});

beforeEach(function() {
beforeEach(function () {
sinon.stub(dataservice, 'getCustomers').returns($q.when(customers));
controller = $controller('Customers');
$rootScope.$apply();
});

bard.verifyNoOutstandingHttpRequests();

describe('Customers controller', function() {
describe('Customers controller', function () {
it('should be created successfully', function () {
expect(controller).to.be.defined;
});

describe('after activate', function() {
describe('after activate', function () {
it('should have called dataservice.getCustomers 1 time', function () {
expect(dataservice.getCustomers).to.have.been.calledOnce;
});

it('should have title of Customers', function() {
it('should have title of Customers', function () {
expect(controller.title).to.equal('Customers');
});

it('should have 5 Customers', function() {
it('should have 5 Customers', function () {
expect(controller.customers).to.have.length(5);
});

it('should have logged "Activated"', function() {
it('should have logged "Activated"', function () {
expect($log.info.logs).to.match(/Activated/);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
<script src="/src/client/app/dashboard/dashboard.module.js"></script>
<script src="/src/client/app/layout/layout.module.js"></script>
<script src="/src/client/app/widgets/widgets.module.js"></script>
<script src="/src/client/app/blocks/logger/logger.module.js"></script>
<script src="/src/client/app/blocks/exception/exception.module.js"></script>
<script src="/src/client/app/blocks/logger/logger.module.js"></script>
<script src="/src/client/app/blocks/router/router.module.js"></script>
<script src="/src/client/app/core/config.js"></script>
<script src="/src/client/app/core/constants.js"></script>
Expand All @@ -86,9 +86,9 @@
<script src="/src/client/app/layout/sidebar.controller.js"></script>
<script src="/src/client/app/widgets/ht-img-person.directive.js"></script>
<script src="/src/client/app/widgets/ht-widget-header.directive.js"></script>
<script src="/src/client/app/blocks/logger/logger.js"></script>
<script src="/src/client/app/blocks/exception/exception-handler.provider.js"></script>
<script src="/src/client/app/blocks/exception/exception.js"></script>
<script src="/src/client/app/blocks/logger/logger.js"></script>
<script src="/src/client/app/blocks/router/router-helper.provider.js"></script>
<!-- endinject -->

Expand Down
14 changes: 9 additions & 5 deletions src/client/specs.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,21 @@ <h1><a href="specs.html">Spec Runner</a></h1>
<script src="/bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="/bower_components/toastr/toastr.js"></script>
<script src="/bower_components/angular-animate/angular-animate.js"></script>
<script src="/bower_components/angular-mocks/angular-mocks.js"></script>
<script src="/bower_components/sinon/index.js"></script>
<script src="/bower_components/bardjs/dist/bard.js"></script>
<script src="/bower_components/bardjs/dist/bard-ngRouteTester.js"></script>
<!-- endbower -->

<!-- inject:js -->
<script src="/src/client/app/app.module.js"></script>
<script src="/src/client/app/core/core.module.js"></script>
<script src="/src/client/app/customers/customers.module.js"></script>
<script src="/src/client/app/dashboard/dashboard.module.js"></script>
<script src="/src/client/app/layout/layout.module.js"></script>
<script src="/src/client/app/widgets/widgets.module.js"></script>
<script src="/src/client/app/blocks/logger/logger.module.js"></script>
<script src="/src/client/app/layout/layout.module.js"></script>
<script src="/src/client/app/blocks/exception/exception.module.js"></script>
<script src="/src/client/app/blocks/logger/logger.module.js"></script>
<script src="/src/client/app/blocks/router/router.module.js"></script>
<script src="/src/client/app/core/config.js"></script>
<script src="/src/client/app/core/constants.js"></script>
Expand All @@ -75,15 +79,15 @@ <h1><a href="specs.html">Spec Runner</a></h1>
<script src="/src/client/app/customers/customers.route.js"></script>
<script src="/src/client/app/dashboard/dashboard.controller.js"></script>
<script src="/src/client/app/dashboard/dashboard.route.js"></script>
<script src="/src/client/app/widgets/ht-img-person.directive.js"></script>
<script src="/src/client/app/widgets/ht-widget-header.directive.js"></script>
<script src="/src/client/app/layout/ht-sidebar.directive.js"></script>
<script src="/src/client/app/layout/ht-top-nav.directive.js"></script>
<script src="/src/client/app/layout/shell.controller.js"></script>
<script src="/src/client/app/layout/sidebar.controller.js"></script>
<script src="/src/client/app/widgets/ht-img-person.directive.js"></script>
<script src="/src/client/app/widgets/ht-widget-header.directive.js"></script>
<script src="/src/client/app/blocks/logger/logger.js"></script>
<script src="/src/client/app/blocks/exception/exception-handler.provider.js"></script>
<script src="/src/client/app/blocks/exception/exception.js"></script>
<script src="/src/client/app/blocks/logger/logger.js"></script>
<script src="/src/client/app/blocks/router/router-helper.provider.js"></script>
<!-- endinject -->

Expand Down

0 comments on commit 94f14fd

Please sign in to comment.