Browse files

added cucumber support… just because

  • Loading branch information...
1 parent 4f1acd2 commit 2830c2d28d536bcaaa260badc99ebe190ef5e708 Daniel Dosen committed Apr 4, 2012
View
1 Procfile
@@ -2,6 +2,7 @@
/* mongo: mongod --rest */
web: nodemon server.coffee
rabbit_listen: nodemon server_mon.coffee
+/* cucumber: ./node_modules/.bin/cucumber.js */
jasmine: bundle exec jasmine-node --coffee --autotest spec
/* TODO: prod */
View
10 features/sample.feature
@@ -0,0 +1,10 @@
+Feature: Example feature
+ As a user of cucumber.js
+ I want to have documentation on cucumber
+ So that I can concentrate on building awesome applications
+
+ Scenario: Reading documentation
+ Given I am on the cucumber.js github page
+ When I go to the README file
+ Then I should see "Usage"
+
View
25 features/step_definitions/my_step_definitions.coffee
@@ -0,0 +1,25 @@
+myStepDefinitionsWrapper = ->
+ @World = require("../support/world.js").World
+ @Given /REGEXP/, (callback) ->
+ @visit "http://github.com/cucumber/cucumber-js", callback
+
+ @When /REGEXP/, (callback) ->
+ callback.pending()
+
+ @Then /REGEXP/, (callback) ->
+ unless @isOnPageWithTitle("Cucumber.js demo")
+ callback.fail new Error("Expected to be on 'Cucumber.js demo' page")
+ else
+ callback()
+
+ @Given /^I am on the cucumber\.js github page$/, (callback) ->
+ callback.pending()
+
+ @When /^I go to the README file$/, (callback) ->
+ callback.pending()
+
+ @Then /^I should see "([^"]*)"$/, (arg1, callback) ->
+ callback.pending()
+
+module.exports = myStepDefinitionsWrapper
+
View
19 features/support/after_hooks.js
@@ -0,0 +1,19 @@
+// features/support/after_hooks.js
+
+// var myAfterHooks = function () {
+// this.After(function(callback) {
+// // Again, "this" is set to the World instance the scenario just finished
+// // playing with.
+
+// // We can then do some cleansing:
+
+// this.emptyDatabase();
+// this.shutdownFullTextSearchServer();
+
+// // Release control:
+// callback();
+// });
+// };
+
+// module.exports = myAfterHooks;
+
View
22 features/support/hooks.js
@@ -0,0 +1,22 @@
+// // features/support/hooks.js (this path is just a suggestion)
+
+// var myHooks = function () {
+// this.Before(function(callback) {
+// // Just like inside step definitions, "this" is set to a World instance.
+// // It's actually the same instance the current scenario step definitions
+// // will receive.
+
+// // Let's say we have a bunch of "maintenance" methods available on our World
+// // instance, we can fire some to prepare the application for the next
+// // scenario:
+
+// this.bootFullTextSearchServer();
+// this.createSomeUsers();
+
+// // Don't forget to tell Cucumber when you're done:
+// callback();
+// });
+// };
+
+// module.exports = myHooks;
+
View
14 features/support/world.js
@@ -0,0 +1,14 @@
+// features/support/world.js
+
+var zombie = require('zombie');
+var World = function World(callback) {
+ this.browser = new zombie.Browser(); // this.browser will be available in step definitions
+
+ this.visit = function(url, callback) {
+ this.browser.visit(url, callback);
+ };
+
+ callback(); // tell Cucumber we're finished and to use 'this' as the world instance
+};
+exports.World = World;
+
View
3 package.json
@@ -4,12 +4,15 @@
, "private": true
, "dependencies": {
"jade": ">= 0.0.1",
+ "express": "*",
"coffee-script": "*",
"jasmine-node": "*",
+ "cucumber": "latest",
"klass": "*",
"nodemon": "*",
"underscore": "*",
"riak-js": "*",
+ "rabbit.js": "*",
"rabbitmq-nodejs-client": "*"
}
}

0 comments on commit 2830c2d

Please sign in to comment.