Skip to content

Instantly share code, notes, and snippets.

@yuya-matsushima
Created September 3, 2014 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuya-matsushima/ae7bc89fa72f683eeb4d to your computer and use it in GitHub Desktop.
Save yuya-matsushima/ae7bc89fa72f683eeb4d to your computer and use it in GitHub Desktop.
Feature: Middleman-Typescript
Scenario: Middleman build
Given a fixture app "basic-app"
And a file named "config.rb" with:
"""
ignore "source/typescripts/*"
activate :typescript
"""
And a successfully built app at "basic-app"
When I cd to "build"
Then a file named "javascripts/sample-typescript.js" should exist
And the file "javascripts/sample-Typescript.js" should contain exactly:
"""
var Greeter = (function () {
function Greeter(greeting) {
this.greeting = greeting;
}
Greeter.prototype.greet = function () {
return "<h1>" + this.greeting + "</h1>";
};
return Greeter;
})();
;
var greeter = new Greeter("Hello, world!");
var str = greeter.greet();
document.body.innerHTML = str;
"""
Scenario: Add new file
Given a fixture app "basic-app"
And a file named "config.rb" with:
"""
ignore "source/typescripts/*"
activate :typescript
"""
And the Server is running at "basic-app"
When a file named "source/typescripts/sample-typescript2.ts" with:
"""
class Greeter {
constructor(public greeting: string) { }
greet() {
return "<h1>" + this.greeting + "</h1>";
}
};
"""
Then I cd to "source"
And a file named "typescripts/sample-typescript2.ts" should exist
And a file named "javascripts/sample-typescript2.js" should exist
And the file "javascripts/sample-Typescript2.js" should contain exactly:
"""
var Greeter = (function () {
function Greeter(greeting) {
this.greeting = greeting;
}
Greeter.prototype.greet = function () {
return "<h1>" + this.greeting + "</h1>";
};
return Greeter;
})();
;
"""
Scenario: File changed
Given a fixture app "basic-app"
And a file named "config.rb" with:
"""
ignore "source/typescripts/*"
activate :typescript
"""
And the Server is running at "basic-app"
When I overwrite "source/typescripts/sample-typescript.ts" with:
"""
class Greeter {
constructor(public greeting: string) { }
greet() {
return "<h1>" + this.greeting + "</h1>";
}
};
"""
Then I cd to "source"
And a file named "javascripts/sample-typescript.js" should exist
And the file "javascripts/sample-Typescript.js" should contain exactly:
"""
var Greeter = (function () {
function Greeter(greeting) {
this.greeting = greeting;
}
Greeter.prototype.greet = function () {
return "<h1>" + this.greeting + "</h1>";
};
return Greeter;
})();
;
"""
Scenario: File removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment