diff --git a/.gitignore b/.gitignore
index fdb463b..33dc263 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,5 @@ npm-debug.log
.directory
._*
*.iml
+/test-output/
+/test/fixtures/scenarios/*/actual
\ No newline at end of file
diff --git a/handlebars/helpers.js b/handlebars/helpers.js
index bed6452..f30bd5b 100644
--- a/handlebars/helpers.js
+++ b/handlebars/helpers.js
@@ -254,8 +254,6 @@ module.exports = {
console.log('Cannot find repository url')
url = null
}
-
- console.log(url.replace(''))
},
/**
diff --git a/package.json b/package.json
index e3c50a0..8455ecc 100644
--- a/package.json
+++ b/package.json
@@ -58,6 +58,7 @@
"chai-as-promised": "^5.1.0",
"husky": "^0.12.0",
"mocha": "^2.2.5",
+ "recursive-copy": "^2.0.5",
"thoughtful-release": "^0.3.0"
},
"standard": {
diff --git a/test/fixtures/scenarios/simple-project/expected/CONTRIBUTING.md b/test/fixtures/scenarios/simple-project/expected/CONTRIBUTING.md
new file mode 100644
index 0000000..e259250
--- /dev/null
+++ b/test/fixtures/scenarios/simple-project/expected/CONTRIBUTING.md
@@ -0,0 +1,55 @@
+## Contributing
+
+Contributions and feedback are always welcome. The expected procedure is the following:
+
+### Bugs, Features and Feedback
+
+* Please, create github issues for **feature-requests**, **bug reports**.
+* Feel free to open issues for **questions and problems you have**, even if they are not bugs
+ or feature requests.
+* You may even open an issue just to say you like the project.
+* For small changes, such as **typo and formatting corrections**, you can immediately
+ create a pull-request. You can use the github web-interface, but keep in mind that most of the documentation
+ is created with Thought, so you should change the template in the `.thought` directory or change the default
+ templates in [the thought project](https://github.com/nknapp/thought/tree/master/handlebars).
+* If you have an idea for a **new feature** that you would like to implement, please **open an issue** first and ask
+ for feedback. Maybe someone else has a similar problem and different ideas.
+* If you encounter a bug you can submit a **pull-request for a failing unit test**, you should then also open an issue
+ for the bug.
+* Before making a pull-request, make sure that you commit corresponds to the coding-style. You can do this by
+ running `npm test`.
+
+**People submitting relevant contributions will be granted commit access to the repository.**
+
+
+### Coding style
+
+[![standard][standard-image]][standard-url]
+
+This repository uses [`standard`][standard-url] to maintain code style and consistency,
+and to avoid style arguments. You can run `npm run format` to apply the coding-style, but
+you may need to fix some things manually. Make sure to use the latest version of `standard`.
+
+
+### Installing & Testing
+
+You can fork and clone the repo from github. Run
+
+* Run `npm install` to install all the dependencies needed to build and run the project.
+* Run `npm test` to run unit tests and validate the `standard` coding-style.
+
+It is intentional to don't have `standard`, `thought`, `istanbul` and `coveralls` in the devDependencies.
+`standard` is a rather large package which you would not want to have copied into the `node_modules`-folder
+of each of your projects.
+
+Instead, the `pretest`- and `preformat`-scripts ensure that `standard` and `thought` are installed globally.
+If you are not allowed to install packages globally, please raise an issue, so that we can try to find a solution.
+
+
+### About this text
+
+This text is part of the [Thought](https://github.com/nknapp/thought)-project. If you have any suggestions or wishes
+to change the text, please raise an issue there for discussion.
+
+[standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg
+[standard-url]: https://github.com/feross/standard
diff --git a/test/fixtures/scenarios/simple-project/expected/README.md b/test/fixtures/scenarios/simple-project/expected/README.md
new file mode 100644
index 0000000..97e8811
--- /dev/null
+++ b/test/fixtures/scenarios/simple-project/expected/README.md
@@ -0,0 +1,48 @@
+# simple-project
+
+[![NPM version](https://badge.fury.io/js/simple-project.svg)](http://badge.fury.io/js/simple-project)
+[![Travis Build Status](https://travis-ci.org/.svg?branch=master)](https://travis-ci.org/)
+[![Coverage Status](https://img.shields.io/coveralls/.svg)](https://coveralls.io/r/)
+
+
+>
+
+
+# Installation
+
+```
+npm install simple-project
+```
+
+
+## API-reference
+
+
+
+## thought(options)
+Execute Thought in the current directory
+
+**Kind**: global function
+**Api**: public
+
+| Param | Type | Description |
+| --- | --- | --- |
+| options | object
| |
+| [options.cwd] | string
| the working directory to use as project root |
+| [options.addToGit] | boolean
| add created files to git |
+
+
+
+
+## License
+
+`simple-project` is published under the ISC-license.
+See []() for details.
+
+## Release-Notes
+
+For release notes, see [CHANGELOG.md](CHANGELOG.md)
+
+## Contributing guidelines
+
+See [CONTRIBUTING.md](CONTRIBUTING.md).
\ No newline at end of file
diff --git a/test/fixtures/scenarios/simple-project/expected/package.json b/test/fixtures/scenarios/simple-project/expected/package.json
new file mode 100644
index 0000000..20368e4
--- /dev/null
+++ b/test/fixtures/scenarios/simple-project/expected/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "simple-project",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "fs-walker": "^1.0.0"
+ }
+}
diff --git a/test/fixtures/scenarios/simple-project/input/package.json b/test/fixtures/scenarios/simple-project/input/package.json
new file mode 100644
index 0000000..20368e4
--- /dev/null
+++ b/test/fixtures/scenarios/simple-project/input/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "simple-project",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "fs-walker": "^1.0.0"
+ }
+}
diff --git a/test/integration-test.js b/test/integration-test.js
new file mode 100644
index 0000000..0c122c7
--- /dev/null
+++ b/test/integration-test.js
@@ -0,0 +1,101 @@
+/*!
+ * thought
+ *
+ * Copyright (c) 2015 Nils Knappmeier.
+ * Released under the MIT license.
+ */
+
+/* global describe */
+/* global it */
+/* global before */
+// /* global xdescribe */
+// /* global xit */
+
+'use strict'
+
+var fs = require('fs')
+var qfs = require('m-io/fs')
+var deep = require('deep-aplus')(Promise)
+var copy = require('recursive-copy')
+
+var path = require('path')
+var chai = require('chai')
+var chaiAsPromised = require('chai-as-promised')
+chai.use(chaiAsPromised)
+var expect = chai.expect
+var thought = require('../')
+
+var basedir = path.resolve('test', 'fixtures', 'scenarios')
+var scenarios = fs.readdirSync(basedir).map((name) => {
+ return {
+ name: name,
+ input: path.join(basedir, name, 'input'),
+ expected: path.join(basedir, name, 'expected'),
+ actual: path.join(basedir, name, 'actual'),
+ readExpected: function readExpected (relativePath) {
+ return qfs.read(path.join(this.expected, relativePath))
+ },
+ readActual: function readActual (relativePath) {
+ return qfs.read(path.join(this.actual, relativePath))
+ }
+ }
+})
+
+function listTreeRelative (baseDir, filter) {
+ return qfs.listTree(baseDir, filter)
+ .then((result) => {
+ const relativeFiles = result.map((_path) => {
+ return path.relative(baseDir, _path)
+ })
+ relativeFiles.sort()
+ return relativeFiles
+ })
+}
+
+function walk (baseDir, relativeDir, callback) {
+ var dirEntries = fs.readdirSync(path.join(baseDir, relativeDir))
+ dirEntries.forEach(function (fileOrDir) {
+ const relativePath = path.join(relativeDir, fileOrDir)
+ const fullPath = path.join(baseDir, relativePath)
+ var stats = fs.statSync(fullPath)
+ if (stats.isDirectory()) {
+ walk(baseDir, relativePath, callback)
+ } else if (stats.isFile()) {
+ callback({ relativePath })
+ }
+ })
+}
+
+describe('the integation test: ', function () {
+ scenarios.forEach((scenario) => {
+ describe(`In the scenario name "${scenario.name}",`, function () {
+ before(function () {
+ return qfs.removeTree(scenario.actual)
+ .then(() => copy(scenario.input, scenario.actual))
+ .then(() => thought({ cwd: scenario.actual }))
+ })
+
+ it('should have the same files as in the output', function () {
+ var filter = (name, stats) => stats.isFile()
+ var expected = listTreeRelative(scenario.expected, filter)
+ var actual = listTreeRelative(scenario.actual, filter)
+ return deep({ expected, actual })
+ .then(function (result) {
+ console.log(result)
+ expect(result.actual).to.deep.equal(result.expected)
+ })
+ })
+
+ walk(scenario.expected, '', function (file) {
+ it(`the file "${file.relativePath}" should match`, function () {
+ var expectedContents = scenario.readExpected(file.relativePath)
+ var actualContents = scenario.readActual(file.relativePath)
+ return deep({expectedContents, actualContents})
+ .then((result) => expect(result.actualContents).to.equal(result.expectedContents)
+ )
+ })
+ })
+ })
+ })
+})
+