Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Commit

Permalink
Update tests to my new style
Browse files Browse the repository at this point in the history
  • Loading branch information
phawk committed Sep 28, 2013
1 parent 68a04b2 commit c528598
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
6 changes: 0 additions & 6 deletions assets/javascripts/build.37be759a8a15adc1c085c53695caf67b.js

This file was deleted.

4 changes: 4 additions & 0 deletions changelog.md
@@ -1,5 +1,9 @@
# Recent changes # Recent changes


## 0.3.2 28th Sept 2013

* Bugfix: Grunt watcher for `test` directory

## 0.3.1 28th Sept 2013 ## 0.3.1 28th Sept 2013


* Update to new `bower` and update components * Update to new `bower` and update components
Expand Down
7 changes: 2 additions & 5 deletions readme.md
@@ -1,16 +1,13 @@
# Backbone Stack (0.3.1) # Backbone Stack (0.3.2)


A pre-configured Backbone Stack for starting new projects, it alleviates a lot of the common boilerplate code and setup. It uses AMD modules, mocha for TDD and handlebars precompiled templates. Grunt plays a major role in the automated linting, testing and building of your code. A pre-configured Backbone Stack for starting new projects, it alleviates a lot of the common boilerplate code and setup. It uses AMD modules, mocha for TDD and handlebars precompiled templates. Grunt plays a major role in the automated linting, testing and building of your code.


[![Build Status](https://travis-ci.org/phawk/Backbone-Stack.png?branch=master)](https://travis-ci.org/phawk/Backbone-Stack) [![Build Status](https://travis-ci.org/phawk/Backbone-Stack.png?branch=master)](https://travis-ci.org/phawk/Backbone-Stack)


### Latest changes (28th Sept 2013) ### Latest changes (28th Sept 2013)


* Bugfix: Grunt watcher for `test` directory
* Update to new `bower` and update components * Update to new `bower` and update components
* Update node version assets to 0.0.8 for some nice bugfixes
* Update travis to use node 0.10
* Update package.json to use grunt 0.4.1 for node 0.10.x
* Upgrade Backbone to v 1.0.0.


[View the changelog](https://github.com/phawk/Backbone-Stack/blob/master/changelog.md) [View the changelog](https://github.com/phawk/Backbone-Stack/blob/master/changelog.md)


Expand Down
27 changes: 16 additions & 11 deletions test/helpers/sandbox.test.js
Expand Up @@ -2,38 +2,43 @@ define(
["chai", "helpers/sandbox"], ["chai", "helpers/sandbox"],
function(chai, Sandbox) { function(chai, Sandbox) {


var expect = chai.expect; var expect = chai.expect,
env;


suite("Sandbox", function() { suite("Sandbox", function() {


setup(function() { setup(function() {
this.sandbox = Sandbox; env = {};

env.sb = sinon.sandbox.create();

env.sandboxSpy = env.sb.spy();

env.sandbox = Sandbox;
}); });


teardown(function() { teardown(function() {
this.sandbox = null; env.sb.restore();
}); });


test("Sandbox should exist", function() { test("Sandbox should exist", function() {
expect(this.sandbox).to.be.ok; expect(env.sandbox).to.be.ok;
}); });


test("should be capable of Pub Sub", function() { test("should be capable of Pub Sub", function() {
// Arrange // Arrange
var sandboxSpy = sinon.spy(); env.sandbox.on("some-event-name", env.sandboxSpy);
this.sandbox.on("some-event-name", sandboxSpy);


// Act // Act
this.sandbox.trigger("some-event-name"); env.sandbox.trigger("some-event-name");


// Assert // Assert
expect(sandboxSpy.called).to.be.true; expect(env.sandboxSpy.called).to.be.true;


// Cleanup // Cleanup
this.sandbox.off("some-event-name", sandboxSpy); env.sandbox.off("some-event-name", env.sandboxSpy);
sandboxSpy = null;
}); });


}); });


}); });
17 changes: 10 additions & 7 deletions test/views/home/main.test.js
Expand Up @@ -2,31 +2,34 @@ define(
["jquery", "chai", "views/home/main"], ["jquery", "chai", "views/home/main"],
function($, chai, HomeMainView) { function($, chai, HomeMainView) {


var expect = chai.expect; var expect = chai.expect,
env;


suite("Home Main View", function() { suite("Home Main View", function() {


setup(function() { setup(function() {
this.homemain = new HomeMainView({ env = {};

env.homemain = new HomeMainView({
el: $('<div>') el: $('<div>')
}); });
}); });


teardown(function() { teardown(function() {
this.homemain = null; env.homemain.remove();
}); });


test("should exist", function() { test("should exist", function() {
expect(this.homemain).to.be.ok; expect(env.homemain).to.be.an("object");
}); });


test("should render a welcome header", function() { test("should render a welcome header", function() {
// Arrange // Arrange
this.homemain.render(); env.homemain.render();


expect(this.homemain.$('h1').text()).to.equal("Welcome"); expect(env.homemain.$('h1').text()).to.equal("Welcome");
}); });


}); });


}); });

0 comments on commit c528598

Please sign in to comment.