diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c554128 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "util/ecukes"] + path = util/ecukes + url = https://github.com/rejeep/ecukes.git +[submodule "util/espuds"] + path = util/espuds + url = https://github.com/rejeep/espuds.git diff --git a/README.md b/README.md index 9e8d1e4..cdfb8f7 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,15 @@ with [Buster.js](http://busterjs.org). All keybindings in buster-mode start with `C-c C-b` and then a two-letter mnemonic shortcut. * `td`: toggle-deferred will toggle // in the name of the current test. + +## Development + +To fetch the test dependencies: + + $ cd /path/to/buster-mode + $ git submodule init + $ git submodule update + +Run the tests with: + + $ ./util/ecukes/ecukes features diff --git a/buster-mode.el b/buster-mode.el new file mode 100644 index 0000000..b350e77 --- /dev/null +++ b/buster-mode.el @@ -0,0 +1 @@ +(provide 'buster-mode) diff --git a/features/buster-mode.feature b/features/buster-mode.feature new file mode 100644 index 0000000..33f9ff2 --- /dev/null +++ b/features/buster-mode.feature @@ -0,0 +1,17 @@ +Feature: Toggle deferred + In order to quickly defer a test + As a buster using emacs user + I want to just press key please + + Scenario: Deferring a test + When I insert: + """ + buster.testCase('Building Page', { + "contains title after loading page": function () { + assert.match(document.body.innerHTML, "Zombie TDD"); + } + }); + """ + And I go to the front of the word "assert" + And I press "C-c C-b td" + Then I should see "//contains" diff --git a/features/step-definitions/basic-steps.el b/features/step-definitions/basic-steps.el new file mode 100644 index 0000000..2a7d563 --- /dev/null +++ b/features/step-definitions/basic-steps.el @@ -0,0 +1,14 @@ +(When "^I go to character \"\\(.+\\)\"$" + (lambda (char) + (goto-char (point-min)) + (let ((search (re-search-forward (format "%s" char) nil t)) + (message "Can not go to character '%s' since it does not exist in the current buffer: %s")) + (assert search nil message char (espuds-buffer-contents))))) + +(When "^I go to the \\(front\\|end\\) of the word \"\\(.+\\)\"$" + (lambda (pos word) + (goto-char (point-min)) + (let ((search (re-search-forward (format "%s" word) nil t)) + (message "Can not go to character '%s' since it does not exist in the current buffer: %s")) + (assert search nil message word (espuds-buffer-contents)) + (if (string-equal "front" pos) (backward-word))))) diff --git a/features/support/env.el b/features/support/env.el new file mode 100644 index 0000000..f258fcc --- /dev/null +++ b/features/support/env.el @@ -0,0 +1,23 @@ +(let* ((current-directory (file-name-directory load-file-name)) + (features-directory (expand-file-name ".." current-directory)) + (project-directory (expand-file-name ".." features-directory))) + (setq buster-mode-root-path project-directory) + (setq buster-mode-util-path (expand-file-name "util" project-directory))) + +(add-to-list 'load-path buster-mode-root-path) +(add-to-list 'load-path (expand-file-name "espuds" buster-mode-util-path)) + +(require 'buster-mode) +(require 'espuds) +(require 'ert) + +(Before + (switch-to-buffer + (get-buffer-create "*buster-mode*")) + (erase-buffer) + (transient-mark-mode 1) + (cua-mode 0) + (setq set-mark-default-inactive nil) + (deactivate-mark)) + +(After) diff --git a/util/ecukes b/util/ecukes new file mode 160000 index 0000000..4b30d7d --- /dev/null +++ b/util/ecukes @@ -0,0 +1 @@ +Subproject commit 4b30d7dd4ccf070a5efc73d5615e815ece484882 diff --git a/util/espuds b/util/espuds new file mode 160000 index 0000000..62ef75c --- /dev/null +++ b/util/espuds @@ -0,0 +1 @@ +Subproject commit 62ef75cb51eef76c547d33a81cb2b6b6e384aefc