Skip to content

Instantly share code, notes, and snippets.

@jak78
Created August 1, 2012 09:51
Show Gist options
  • Save jak78/3225514 to your computer and use it in GitHub Desktop.
Save jak78/3225514 to your computer and use it in GitHub Desktop.
# Used for Jasmine tests in CI and in developer PC with http://localhost:3000/jasmine
# You need to install PhantomJS on your PC/Mac or VM to run Jasmine tests.
group :development, :test do
gem "jasminerice", '0.0.9' # Use Jasmine with asset pipeline in order to test with CoffeeScript, HAML and SASS.
gem "jasminerice-runner", '0.0.3' # Make JasmineRice run in command line with 'rake jasminerice:run'
gem "poltergeist", '0.7.0' # jasminerice-runner uses Capybara to run Jasmine, and Poltergeist adds PhantomJS support to Capypara to make tests run headlessly on CI.
gem "guard-jasmine"
end
guard 'jasmine' do
watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { "spec/javascripts" }
watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)$}) { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
end
# Our Jasmine tests in CI are run using Capybara.
# These lines makes Capybara use Poltergeist which enables it to run headless in a CI server without graphical environment.
require 'capybara/poltergeist'
Jasminerice::Runner.capybara_driver = :poltergeist
# Capybara default timeout of 2 seconds is too short because our Jasmine tests suite run in several seconds.
# That's why we need to increase this timeout.
Capybara.default_wait_time = 5*60 # We hope our Jasmine tests won't run in more that 5 minutes, this would be very long.
# To run Jasmine tests with rake by default
task :default => ["jasminerice:run"]
# Put this file in spec/javascripts
#=require_tree ./
#=require application
#=require jasminerice_reporter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment