Permalink
Browse files

Fixes for running brunch test

Added _test to test generators so brunch will gather them for tests.
Added a test-helpers script for importing the needed modules. Added
sample app_view test. Revised the module generator script.
  • Loading branch information...
1 parent 0d55e3d commit 4f9c7c322ba33e570d45fc7192dbec3e99e93dd3 @mikeedwards mikeedwards committed Nov 10, 2012
@@ -5,5 +5,6 @@ module.exports = class AppView extends View
el: 'body.application'
initialize: ->
- @router = Hipster.Routers.AppRouter = new AppRouter()
+ @router = new AppRouter()
+ Hipster?.Routers?.AppRouter = @router
View
@@ -12,6 +12,8 @@ exports.config =
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
+ 'test/javascripts/test.js': /^test(\/|\\)(?!vendor)/
+ 'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/
order:
# Files in `vendor` directories are compiled before other files
# even if they aren't specified in order.
@@ -1,7 +1,7 @@
{
"files": [{
"from": "model_test.coffee.hbs",
- "to": "test/models/{{name}}.coffee"
+ "to": "test/models/{{name}}_test.coffee"
}],
"dependencies": []
}
@@ -1,21 +1,19 @@
{
- "files": [
- {
- "from": "model.coffee.hbs",
- "to": "app/models/{{name}}.coffee"
- },
- {
- "from": "view.coffee.hbs",
- "to": "app/views/{{name}}.coffee"
- },
- {
- "from": "template.hbs.hbs",
- "to": "app/views/templates/{{name}}.hbs"
- },
- {
- "from": "style.styl.hbs",
- "to": "app/views/styles/_{{name}}.styl"
- }
- ],
- "dependencies": []
+ "files": [{
+ "from": "view.coffee.hbs",
+ "to": "app/views/{{name}}.coffee"
+ }],
+ "dependencies": [{
+ "name": "model",
+ "params": "{{name}}"
+ }, {
+ "name": "view_test",
+ "params": "{{name}}"
+ }, {
+ "name": "style",
+ "params": "{{name}}"
+ }, {
+ "name": "template",
+ "params": "{{name}}"
+ }]
}
@@ -1 +0,0 @@
-module.exports = class {{#camelize}}{{name}}{{/camelize}}Model extends Backbone.Model
@@ -1,3 +0,0 @@
-.{{name}}
- // {{#camelize}}{{name}}{{/camelize}} Module
-
@@ -1,4 +0,0 @@
-<section class="{{name}}">
-
-</section>
-<!-- .{{name}} -->
@@ -2,7 +2,7 @@
"files": [
{
"from": "view_test.coffee.hbs",
- "to": "test/views/{{name}}.coffee"
+ "to": "test/views/{{name}}_test.coffee"
}
],
"dependencies": []
@@ -0,0 +1,4 @@
+expect = require 'expect.js'
+
+module.exports =
+ expect: expect
@@ -0,0 +1,8 @@
+AppView = require 'views/app_view'
+
+describe 'AppView', ->
+ beforeEach ->
+ @view = new AppView()
+
+ it "should exist", ->
+ expect( @view ).to.be.ok()

0 comments on commit 4f9c7c3

Please sign in to comment.