GithubHelp home page GithubHelp logo

jasmine_on_rails_example's Introduction

Quick Start

Install Jasmine

mkdir -p spec/javascript
cd spec/javascript
git clone git://github.com/pivotal/jasmine.git
cp jasmine/examples/ruby/spec/jasmine_helper.rb ./
cp jasmine/examples/ruby/spec/jasmine_spec.rb ./

Customize your spec/javascript/jasmine_helper.rb

  1. Fix some paths
  • jasmine_root

    File.expand_path(File.join(File.dirname(FILE), 'spec'))

  • jasmine_spec_dir

    File.expand_path(File.join(File.dirname(FILE), 'spec'))

  1. Add some more dir_mappings

    "/helpers" => File.join(jasmine_spec_dir, 'spec_helpers') "/public" => File.join(File.dirname(FILE),'..','..','public')

  2. Get your spec_helper.js to be included in your

  • spec_file_urls

    ['/helpers/spec_helper.js'] + raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}

Create some supporting files

cd RAILS_ROOT
mkdir -p spec/javascript/spec/spec_helpers
  1. Your spec helper is where you will include all your implementation code and libraries
  • spec/javascript/spec/spec_helpers/spec_helper.js

    jasmine.include('public/javascripts/jquery/jquery-1.3.2.js', true); jasmine.include('public/javascripts/some_implementation.js', true); //if you want to make some custom matchers you can include them here as well jasmine.include('helpers/custom_matchers.js', true);

Copy the Rakefile under examples/ruby into your lib/tasks/jasmine.rake

cd RAILS_ROOT
cp -p spec/javascript/jasmine/examples/ruby/RAKEFILE lib/tasks/jasmine.rake

NOTE: I changed the rake tasks from:

  • test:ci to spec:jasmine
  • jasmine_server to spec:jsamine_server

So now to run it in the browser I run

rake spec:jsamine_server

and to run it via command-line (using selenium)

rake spec:jasmine

jasmine_on_rails_example's People

Contributors

codeword avatar

Stargazers

 avatar

Watchers

 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.