Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Demo app for the JasmineCoffee CodeTV screencast

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 log
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 test
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 config.ru
README.md

Description

The client-side of your application deserves some tests too. In this episode we'll look at how to use the Jasmine testing framework with CoffeeScript inside of Rails. http://www.codeschool.com/code_tv/testing-coffeescript-with-jasmine

Notes

gemfile add

group :development, :test do
  gem 'evergreen', require:'evergreen/rails'
end

run bundle to install

$ bundle

see new evergreen rake command

$ rake -T spec

Run JavaScript specs via Evergreen

$ rake spec:javascripts

Create folder for tests

$ mkdir -p spec/javascripts
$ touch spec/javascripts/demo_spec.coffee

Add this to demo_spec.coffee

describe 'A Calculator', ->
  it 'should add two numbers', ->
  result = myApp.Calculator.add(2,3)
  expect(result).toEqual(5)

Run test again

$ rake spec:javascripts

Start evergreen server

$ evergreen serve

Add to spec/javascripts/demo_spec.coffee

myApp = {}
myApp.Calculator = {
  add: (a,b) -> a + b
}

Setup guitar app and Tests

In order to setup the app locally, first run bundle to install dependencies. Then, run bundle exec rake db:create db:migrate db:test:prepare to setup you database. To run the test suite including Jasmine specs, run bundle exec rake.

Something went wrong with that request. Please try again.