Giter VIP home page Giter VIP logo

jasminecoffee's Introduction

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.

jasminecoffee's People

Contributors

caike avatar mhenke avatar

Watchers

James Cloos avatar Nate avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.