Skip to content

Commit

Permalink
1st!
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed Apr 20, 2012
0 parents commit 2fb0de8
Show file tree
Hide file tree
Showing 13 changed files with 512 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules
test/
25 changes: 25 additions & 0 deletions Makefile
@@ -0,0 +1,25 @@
.PHONY: template test

url = https://raw.github.com/mojombo/jekyll/master/features

all: template generate test

template:
@echo "... Build the template ...\n"
@node node_modules/hogan/bin/hulk body.mustache \
| sed 's/{}/module.exports/' \
| cat template/head.js - template/tail.js \
> template/index.js

generate:
@echo "... Build the test files, requesting some of jekyll features ...\n"

node examples/stdout.js >> test/stdout.js
node examples/request.js $(url)/permalinks.feature >> test/permalinks.js
node examples/request.js $(url)/create_sites.feature >> test/create_sites.js
node examples/request.js $(url)/markdown.feature >> test/markdown.js

test:
@echo "... Build the test files, requesting some of jekyll features ...\n"
node node_modules/.bin/mocha

25 changes: 25 additions & 0 deletions body.mustache
@@ -0,0 +1,25 @@

//
// Mocha generated tests
//

describe("{{ feature.name }}", function() {
describe("{{{ feature.desc }}}", function() {
{{#scenarios}}

describe("{{{ name }}}", function() {
{{#steps}}

it("{{{ name }}}", function() {
});
{{/steps}}

});
{{/scenarios}}

});

});

18 changes: 18 additions & 0 deletions examples/basics.feature
@@ -0,0 +1,18 @@
# features/myFeature.feature

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 repository
When I go to the README file
Then I should see "Usage" as the page title


Scenario: Reading the tests
Given I am in the text directory
When I read the index.js file
Then I should see "new Parser" somewhere

145 changes: 145 additions & 0 deletions examples/jekyll.feature
@@ -0,0 +1,145 @@
Feature: Site configuration
As a hacker who likes to blog
I want to be able to configure jekyll
In order to make setting up a site easier

Scenario: Change destination directory
Given I have a blank site in "_sourcedir"
And I have an "_sourcedir/index.html" file that contains "Changing source directory"
And I have a configuration file with "source" set to "_sourcedir"
When I run jekyll
Then the _site directory should exist
And I should see "Changing source directory" in "_site/index.html"

Scenario: Change destination directory
Given I have an "index.html" file that contains "Changing destination directory"
And I have a configuration file with "destination" set to "_mysite"
When I run jekyll
Then the _mysite directory should exist
And I should see "Changing destination directory" in "_mysite/index.html"

Scenario: Exclude files inline
Given I have an "Rakefile" file that contains "I want to be excluded"
And I have an "README" file that contains "I want to be excluded"
And I have an "index.html" file that contains "I want to be included"
And I have a configuration file with "exclude" set to "Rakefile", "README"
When I run jekyll
Then I should see "I want to be included" in "_site/index.html"
And the "_site/Rakefile" file should not exist
And the "_site/README" file should not exist

Scenario: Exclude files with YAML array
Given I have an "Rakefile" file that contains "I want to be excluded"
And I have an "README" file that contains "I want to be excluded"
And I have an "index.html" file that contains "I want to be included"
And I have a configuration file with "exclude" set to:
| value |
| README |
| Rakefile |
When I run jekyll
Then I should see "I want to be included" in "_site/index.html"
And the "_site/Rakefile" file should not exist
And the "_site/README" file should not exist

Scenario: Use RDiscount for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "rdiscount"
When I run jekyll
Then the _site directory should exist
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"

Scenario: Use Kramdown for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "kramdown"
When I run jekyll
Then the _site directory should exist
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"

Scenario: Use Redcarpet for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "redcarpet"
When I run jekyll
Then the _site directory should exist
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"

Scenario: Use Maruku for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "maruku"
When I run jekyll
Then the _site directory should exist
And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"

Scenario: Highlight code with pygments
Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
And I have a configuration file with "pygments" set to "true"
When I run jekyll
Then the _site directory should exist
And I should see "puts 'Hello world!'" in "_site/index.html"

Scenario: Set time and no future dated posts
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
And I have a post layout that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| time | 2010-01-01 |
| future | false |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 12/31/2007 | post | content for entry1. |
| entry2 | 01/31/2020 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And the "_site/2020/01/31/entry2.html" file should not exist

Scenario: Set time and future dated posts allowed
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
And I have a post layout that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| time | 2010-01-01 |
| future | true |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 12/31/2007 | post | content for entry1. |
| entry2 | 01/31/2020 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"

Scenario: Limit the number of posts generated by most recent date
Given I have a _posts directory
And I have a configuration file with:
| key | value |
| limit_posts | 2 |
And I have the following posts:
| title | date | content |
| Apples | 3/27/2009 | An article about apples |
| Oranges | 4/1/2009 | An article about oranges |
| Bananas | 4/5/2009 | An article about bananas |
When I run jekyll
Then the _site directory should exist
And the "_site/2009/04/05/bananas.html" file should exist
And the "_site/2009/04/01/oranges.html" file should exist
And the "_site/2009/03/27/apples.html" file should not exist

Scenario: Copy over normally excluded files when they are explicitly included
Given I have a ".gitignore" file that contains ".DS_Store"
And I have an ".htaccess" file that contains "SomeDirective"
And I have a configuration file with "include" set to:
| value |
| .gitignore |
| .foo |
When I run jekyll
Then the _site directory should exist
And I should see ".DS_Store" in "_site/.gitignore"
And the "_site/.htaccess" file should not exist
12 changes: 12 additions & 0 deletions examples/request.js
@@ -0,0 +1,12 @@

var request = require('request');

var Parser = require('../');

var url = process.argv.slice(2)[0];

if(!url) process.exit(1);

request(url)
.pipe(new Parser)
.pipe(process.stdout);
16 changes: 16 additions & 0 deletions examples/stdout.js
@@ -0,0 +1,16 @@

var fs = require('fs'),
path = require('path'),
Parser = require('..');

var args = process.argv.slice(2);

// some test

var feature = args[0] || 'basics.feature';

fs.createReadStream(path.join(__dirname, feature))
.pipe(new Parser).on('close', console.log.bind(console))
.pipe(process.stdout);


23 changes: 23 additions & 0 deletions package.json
@@ -0,0 +1,23 @@
{
"author": "",
"name": "mocha-gherkin",
"version": "0.0.0",
"repository": {
"url": ""
},
"engines": {
"node": "~0.6.1"
},
"dependencies": {
"gherkin": "~2.9.3"
},
"devDependencies": {
"hogan": "~1.0.5-dev",
"mocha": "~1.0.1",
"request": "~2.9.202"
},
"scripts": {
"test": "make"
},
"main": "./parser"
}

0 comments on commit 2fb0de8

Please sign in to comment.