Skip to content
Jasmine ruby gem
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Refactored jasmine command line tool. Jun 25, 2010
lib Bump version to 3.4 Apr 4, 2019
release_notes Bump version to 3.4 Apr 4, 2019
.editorconfig Added an editorconfig file Nov 18, 2017
.gitignore gitignore .rvmrc Apr 12, 2012
.rspec Colorize rspec Jul 11, 2012
.travis.yml Merge branch 'chromeheadless' of Feb 23, 2019
Gemfile Remove branch specifier for dev core depenedency Feb 27, 2018
HOW_TO_TEST.markdown Remove support for Rails 3. It is no longer supported Feb 6, 2018
MIT.LICENSE 1.3.0 Release Nov 27, 2012
README.markdown Add docs for how to use the new Chrome Headless runner Apr 19, 2019
RELEASE.markdown Update dependency of jasmine-core to be 2.0 Dec 16, 2013
Rakefile Cleanup Rakefile Oct 1, 2013
jasmine.gemspec Bump version to 3.4 Apr 4, 2019


The Jasmine Gem Build Status

FOSSA Status

The Jasmine Ruby Gem is a package of helper code for developing Jasmine projects for Ruby-based web projects (Rails, Sinatra, etc.) or for JavaScript projects where Ruby is a welcome partner. It serves up a project's Jasmine suite in a browser so you can focus on your code instead of manually editing script tags in the Jasmine runner HTML file.


This gem contains:

  • A small server that builds and executes a Jasmine suite for a project
  • A script that sets up a project to use the Jasmine gem's server
  • Generators for Ruby on Rails projects (Rails 4 and 5)

You can get all of this by: gem install jasmine or by adding Jasmine to your Gemfile.

group :development, :test do
  gem 'jasmine'

Init A Project

To initialize a rails project for Jasmine

rails generate jasmine:install

rails generate jasmine:examples

For any other project (Sinatra, Merb, or something we don't yet know about) use

jasmine init

jasmine examples


Start the Jasmine server:

rake jasmine

Point your browser to localhost:8888. The suite will run every time this page is re-loaded.

For Continuous Integration environments, add this task to the project build steps:

rake jasmine:ci

This uses PhantomJS to load and run the Jasmine suite.

Please note that PhantomJS will be auto-installed by the phantomjs-gem at the first rake jasmine:ci run. If you have a matching PhantomJS version somewhere on your path, it won't install. You can disable automatic installation altogether (and use the PhantomJS on your path) via the config helper in your jasmine_helper.rb:

Jasmine.configure do |config|
  config.prevent_phantom_js_auto_install = true


Customize spec/javascripts/support/jasmine.yml to enumerate the source files, stylesheets, and spec files you would like the Jasmine runner to include. You may use dir glob strings.

Alternatively, you may specify the path to your jasmine.yml by setting an environment variable:

rake jasmine:ci JASMINE_CONFIG_PATH=relative/path/to/your/jasmine.yml

In addition, the spec_helper key in your jasmine.yml specifies the path to a ruby file that can do programmatic configuration. After running jasmine init or rails generate jasmine:install it will point to spec/javascripts/support/jasmine_helper.rb which you can modify to fit your needs.

Running Jasmine on a different port

The ports that rake jasmine (or rake jasmine:server) and rake jasmine:ci run on are configured independently, so they can both run at the same time.

To change the port that rake jasmine uses:

In your jasmine_helper.rb:

Jasmine.configure do |config|
   config.server_port = 5555

By default rake jasmine:ci will attempt to find a random open port, to set the port that rake jasmine:ci uses:

In your jasmine_helper.rb:

Jasmine.configure do |config|
   config.ci_port = 1234

Using headless Chrome

  • Add chrome_remote as a dependency
  • In your jasmine_helper.rb:
Jasmine.configure do |config|
  config.runner_browser = :chromeheadless

Additional configuration options

  • config.chrome_binary - to customize which binary to execute
  • config.chrome_cli_options - if you know what you're doing you can customize the CLI
  • config.chrome_startup_timeout - change the amount of time to wait for chrome to start

On Travis-CI

Add this to your .travis.yml

  chrome: stable


Documentation: Jasmine Mailing list: Twitter: @jasminebdd

Please file issues here at Github

Copyright (c) 2008-2017 Pivotal Labs. This software is licensed under the MIT License.


FOSSA Status

You can’t perform that action at this time.