Skip to content

Commit

Permalink
Tests up and running.
Browse files Browse the repository at this point in the history
  • Loading branch information
magnars committed Jun 16, 2012
1 parent 56e0b6e commit e123fab
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .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
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -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. 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. * `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
1 change: 1 addition & 0 deletions buster-mode.el
@@ -0,0 +1 @@
(provide 'buster-mode)
17 changes: 17 additions & 0 deletions 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"
14 changes: 14 additions & 0 deletions 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)))))
23 changes: 23 additions & 0 deletions 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)
1 change: 1 addition & 0 deletions util/ecukes
Submodule ecukes added at 4b30d7
1 change: 1 addition & 0 deletions util/espuds
Submodule espuds added at 62ef75

0 comments on commit e123fab

Please sign in to comment.