diff options
| author | mo k <m@mokhan.ca> | 2011-12-28 11:32:15 -0700 |
|---|---|---|
| committer | mo k <m@mokhan.ca> | 2011-12-28 11:32:15 -0700 |
| commit | 76df3a657f46b0b862baa5a5244f5bc2624b8343 (patch) | |
| tree | ad39707776379d674360aef06ca2f1f7ff25f5c0 /spec/javascripts | |
| parent | 150450b97c1aa5296bd3a15c626aafdf4adcebc0 (diff) | |
rails g jasmine:install
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/helpers/.gitkeep | 0 | ||||
| -rw-r--r-- | spec/javascripts/support/jasmine.yml | 81 | ||||
| -rw-r--r-- | spec/javascripts/support/jasmine_config.rb | 23 | ||||
| -rw-r--r-- | spec/javascripts/support/jasmine_runner.rb | 20 |
4 files changed, 124 insertions, 0 deletions
diff --git a/spec/javascripts/helpers/.gitkeep b/spec/javascripts/helpers/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/spec/javascripts/helpers/.gitkeep diff --git a/spec/javascripts/support/jasmine.yml b/spec/javascripts/support/jasmine.yml new file mode 100644 index 00000000..6c844008 --- /dev/null +++ b/spec/javascripts/support/jasmine.yml @@ -0,0 +1,81 @@ +# src_files +# +# Return an array of filepaths relative to src_dir to include before jasmine specs. +# Default: [] +# +# EXAMPLE: +# +# src_files: +# - lib/source1.js +# - lib/source2.js +# - dist/**/*.js +# +src_files: + - public/javascripts/prototype.js + - public/javascripts/effects.js + - public/javascripts/controls.js + - public/javascripts/dragdrop.js + - public/javascripts/application.js + - public/javascripts/**/*.js + +# stylesheets +# +# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs. +# Default: [] +# +# EXAMPLE: +# +# stylesheets: +# - css/style.css +# - stylesheets/*.css +# +stylesheets: + - stylesheets/**/*.css + +# helpers +# +# Return an array of filepaths relative to spec_dir to include before jasmine specs. +# Default: ["helpers/**/*.js"] +# +# EXAMPLE: +# +# helpers: +# - helpers/**/*.js +# +helpers: + - helpers/**/*.js + +# spec_files +# +# Return an array of filepaths relative to spec_dir to include. +# Default: ["**/*[sS]pec.js"] +# +# EXAMPLE: +# +# spec_files: +# - **/*[sS]pec.js +# +spec_files: + - '**/*[sS]pec.js' + +# src_dir +# +# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank. +# Default: project root +# +# EXAMPLE: +# +# src_dir: public +# +src_dir: + +# spec_dir +# +# Spec directory path. Your spec_files must be returned relative to this path. +# Default: spec/javascripts +# +# EXAMPLE: +# +# spec_dir: spec/javascripts +# +spec_dir: spec/javascripts diff --git a/spec/javascripts/support/jasmine_config.rb b/spec/javascripts/support/jasmine_config.rb new file mode 100644 index 00000000..47286f23 --- /dev/null +++ b/spec/javascripts/support/jasmine_config.rb @@ -0,0 +1,23 @@ +module Jasmine + class Config + + # Add your overrides or custom config code here + + end +end + + +# Note - this is necessary for rspec2, which has removed the backtrace +module Jasmine + class SpecBuilder + def declare_spec(parent, spec) + me = self + example_name = spec["name"] + @spec_ids << spec["id"] + backtrace = @example_locations[parent.description + " " + example_name] + parent.it example_name, {} do + me.report_spec(spec["id"]) + end + end + end +end diff --git a/spec/javascripts/support/jasmine_runner.rb b/spec/javascripts/support/jasmine_runner.rb new file mode 100644 index 00000000..de6c1326 --- /dev/null +++ b/spec/javascripts/support/jasmine_runner.rb @@ -0,0 +1,20 @@ +$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes + +require 'rubygems' +require 'jasmine' +require 'rspec' +jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb')) +require jasmine_config_overrides if File.exists?(jasmine_config_overrides) + +jasmine_config = Jasmine::Config.new +spec_builder = Jasmine::SpecBuilder.new(jasmine_config) + +should_stop = false + +RSpec.configuration.after(:suite) do + spec_builder.stop if should_stop +end + +spec_builder.start +should_stop = true +spec_builder.declare_suites
\ No newline at end of file |
