Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Colors added to output, and formating updated.

  • Loading branch information...
commit f5940f9085eb445f56484a50eec21c36c2078a7d 1 parent 0be9e5a
@quangv authored
Showing with 12 additions and 7 deletions.
  1. +1 −0  .gitignore
  2. +2 −0  package.json
  3. +9 −7 src/cakes.coffee
View
1  .gitignore
@@ -1 +1,2 @@
*.swp
+node_modules
View
2  package.json
@@ -3,6 +3,8 @@
, "version" : "0.0.2"
, "author" : "Quang Van <quang@orgnote.com>"
, "homepage" : "https://github.com/quangv/mocha-cakes"
+ , "dependencies" : { "colors" : "*"
+ }
, "devDependencies" : { "coffee-script" : "*"
}
, "keywords" : ["mocha", "bdd", "stories", "cucumber", "test"]
View
16 src/cakes.coffee
@@ -1,34 +1,36 @@
+colors = require 'colors'
+
exports.Feature = (feature, story..., callback)->
# exp. Feature 'new feature', 'in order to do good', 'as a user', 'I want to do good', ->
# message = "Feature: #{feature} \n\n\t#{benefit}\n\t#{who}\n\t#{desire}"
- message = "Feature: #{feature} \n"
+ message = "Feature: #{feature} \n".green.underline
(message += '\n\t'+part for part in story)
describe(message, callback)
return
exports.Scenario = (message, callback)->
- describe("\n Scenario: #{message}", callback)
+ describe("\n Scenario: #{message}".green, callback)
exports.Given = (context, callback)->
if arguments.length == 1
callback = context
- message = 'before'
+ context = 'previous'.grey
describe("Given: #{context}", callback)
exports.When = (action, callback)->
- describe("When: #{action}", callback)
+ describe(" When: #{action}", callback)
exports.And = (more_action_or_outcome, callback)->
- describe(" and: #{more_action_or_outcome}", callback)
+ describe(" and #{more_action_or_outcome}", callback)
exports.Then = (outcome, callback)->
- describe("Then: #{outcome}", callback)
+ describe(" Then: #{outcome}", callback)
exports.But = (not_outcome)->
- describe(" but: #{not_outcome}", callback)
+ describe(" but #{not_outcome}", callback)
# Add function names to global scope.
(global[name] = func for name, func of module.exports)
Please sign in to comment.
Something went wrong with that request. Please try again.