Skip to content

Instantly share code, notes, and snippets.

Created Apr 26, 2012
What would you like to do?
jasmine src and spec creation
if [ -n "$1" ]; then
echo "Creating SOURCE and SPECS files.";
echo "SOURCE -> src/$1.js";
tee src/"$1".js > /dev/null <<SOURCE
function $1(){
echo "SPECS -> spec/$1Spec.js";
tee spec/"$1"Spec.js > /dev/null <<SPEC
describe("$1", function() {
var $1;
beforeEach(function() {
$1 = new $1();
console.log("Add configuration for $1 test");
// Add tests
it("should have a general test", function() {
// Describe scenarios with particular setup.
describe("when you need a particular configuration", function() {
beforeEach(function() {
console.log("Add configuration for a particular $1 test");
it("should have a particular test", function() {
sed "/<!-- include source files here... -->/ a\
<script type='text\/javascript' src='spec\/$1Spec.js'><\/script>" SpecRunner.html > temp.html;
sed "/<!-- include spec files here... -->/ a\
<script type='text\/javascript' src='src\/$1.js'><\/script>" temp.html > SpecRunner.html;
rm temp.html;
echo "Open SpecRunner.html in your browser.";
echo "Update spec/$1Spec.js tests";
echo "Update src/$1.js code"
echo "Create SOURCE and SPECS files, so run with a name";
echo "sh leSource";
echo "-> src/leSource.js";
echo "-> spec/leSourceSpec.js";
echo "next 2 lines added in SpecRunner.html";
echo "-> <script type='text/javascript' src='spec/leSourceSpec.js'></script>";
echo "-> <script type='text/javascript' src='spec/leSource.js'></script>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment