import sys, os

modules = [
    os.path.dirname(__file__),
    os.path.dirname(__file__) + '/support'
]
for module in modules:
    if module not in sys.path:
        sys.path.append(module)

from expects import *
from testfixtures import TempDirectory
from support.runner import Runner
from support.settings import SettingObject

DEFAULT_PROJECT = 'Dummy Project'
DEFAULT_PROJECT_DIR = 'cookiecutter-dummy-project'

with description('Cookiecutter Template'):
    with after.all:
        TempDirectory.cleanup_all()

    with before.each:
        self.tempdir = TempDirectory()
        self.output_dir = self.tempdir.path
        self.project_dir = self.output_dir + '/' + DEFAULT_PROJECT_DIR
        self.settings = SettingObject({"project_name": DEFAULT_PROJECT}, self.output_dir)
        self.runner = Runner(self.settings)

    with after.each:
        self.tempdir.cleanup()

    with context('naming convention'):
        with it('names the directory using the project name rewritten in kebab-case format, prefixed with \'cookiecutter-\''):
            self.runner.run()

            expect(os.path.exists(self.project_dir)).to(be_true)
        
@@ -321,16 +321,89 @@
 ngObject
+%0Afrom cookiecutter.config import get_config%0Afrom datetime import datetime
 %0A%0ADEFAUL
@@ -1208,16 +1208,853 @@
 e_true)%0A        
+%0A    with context('file content'):%0A        with it('fills the VERSION file with the version number'):%0A            expected = '2.0.1'%0A            self.settings.extra_context%5B%22version%22%5D = expected%0A            self.runner.run()%0A            f = open(self.project_dir + '/VERSION', 'r')%0A%0A            expect(f.read()).to(contain_exactly(expected))%0A%0A        with it('fills the LICENSE file with the year, the full name and the email address'):%0A            config = get_config(SettingObject.CONFIG_FILE)%0A            self.runner.run()%0A            f = open(self.project_dir + '/LICENSE', 'r')%0A            actual = f.read()%0A%0A            expect(actual).to(contain(config%5B'default_context'%5D%5B'full_name'%5D))%0A            expect(actual).to(contain(config%5B'default_context'%5D%5B'email'%5D))%0A            expect(actual).to(contain(datetime.now().strftime(%22%25Y%22)))

add specification for LICENSE file content