Permalink
Browse files

Get rid of jasmine, use testacular!

  • Loading branch information...
1 parent 7f97755 commit b09b66096f7cd35bff292fa6150178da11089e65 @lucassus committed Dec 1, 2012
View
@@ -58,5 +58,3 @@ Rake::RDocTask.new do |rd|
end
task :default => [:test,:features]
-
-import 'lib/tasks/jasmine.rake'
@@ -1,5 +1,5 @@
#= require jquery
#= require bootstrap
#= require bootbox
-#= require angular
-#= require angular-resource
+#= require angular/angular
+#= require angular/angular-resource
View
@@ -1,60 +0,0 @@
-begin
- require 'jasmine'
- load 'jasmine/tasks/jasmine.rake'
-
- Rake::Task["jasmine:server"].clear
- Rake::Task["jasmine:ci"].clear
-
- namespace :jasmine do
- # desc "Run specs via server"
- task :server => "jasmine:require" do
- config = Jasmine::Config.new
- root_path = config.project_root
-
- jasmine_config_overrides = File.join(config.project_root, 'spec', 'javascripts' ,'support' ,'jasmine_config.rb')
- require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
-
- port = ENV['JASMINE_PORT'] || 8888
- puts "your tests are here:"
- puts " http://localhost:#{port}/"
-
- # TODO dry it
- app = Jasmine::Application.app
-
- app = Rack::Builder.new(app) do |app|
- app.use Rack::CoffeeCompiler,
- source_extension: 'js.coffee',
- source_dir: File.join(root_path, 'spec/javascripts'),
- url: config.spec_path
-
- app.use Rack::CoffeeCompiler,
- source_extension: 'js.coffee',
- source_dir: File.join(root_path, 'app/assets/javascripts'),
- url: '/app/assets/javascripts'
- end
-
- Jasmine::Server.new(port, app).start
- end
-
- desc "Run continuous integration tests"
- task :ci => ["jasmine:require_json", "jasmine:require"] do
- require "rspec"
- require "rspec/core/rake_task"
-
- RSpec::Core::RakeTask.new(:jasmine_continuous_integration_runner) do |t|
- t.rspec_opts = ["--colour", "--format", ENV['JASMINE_SPEC_FORMAT'] || "progress"]
- t.verbose = true
-
- config = Jasmine::Config.new
- root_path = config.project_root
- t.pattern = [File.join(root_path, "spec/javascripts/support/jasmine_runner.rb")]
- end
-
- Rake::Task["jasmine_continuous_integration_runner"].invoke
- end
- end
-rescue LoadError
- task :jasmine do
- abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
- end
-end
View
@@ -20,9 +20,6 @@ Gem::Specification.new do |gem|
gem.add_development_dependency("rake", "~> 10.0.2")
gem.add_development_dependency("thin", "~> 1.5.0")
- gem.add_development_dependency("jasmine", "~> 1.2.1")
- gem.add_development_dependency("rack-asset-compiler", "~> 0.2.1")
-
gem.add_development_dependency("rspec", "~> 2.12.0")
gem.add_development_dependency("capybara", "~> 1.1.3")
gem.add_development_dependency("capybara-webkit", "~> 0.13.0")
@@ -0,0 +1,27 @@
+basePath = '../../../';
+
+files = [
+ JASMINE,
+ JASMINE_ADAPTER,
+ 'vendor/assets/javascripts/jquery.js',
+ 'vendor/assets/javascripts/angular/angular.js',
+ 'vendor/assets/javascripts/angular/angular-*.js',
+ 'vendor/assets/javascripts/*.js',
+
+ 'app/assets/javascripts/app/**/*.js.coffee',
+ 'app/assets/javascripts/application.js.coffee',
+
+ 'spec/javascripts/lib/angular/angular-mocks.js',
+ 'spec/javascripts/helpers/**/*.js.coffee',
+ 'spec/javascripts/**/*_spec.js.coffee',
+ 'spec/javascripts/**/*_spec.js.coffee'
+];
+
+autoWatch = true;
+
+browsers = ['Chrome'];
+
+junitReporter = {
+ outputFile: 'test_out/unit.xml',
+ suite: 'unit'
+};
@@ -1,84 +0,0 @@
-# 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:
- # vendor files
- - vendor/assets/javascripts/jquery.js
- - vendor/assets/javascripts/angular.js
- - vendor/assets/javascripts/angular-resource.js
- - spec/javascripts/support/vendor/angular-mocks.js
- # app files
- - app/assets/javascripts/app/**/*.js.coffee
- - app/assets/javascripts/application.js.coffee
-
-# stylesheets
-#
-# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
-# Default: []
-#
-# EXAMPLE:
-#
-# stylesheets:
-# - css/style_old.css
-# - stylesheets/*.css
-#
-stylesheets:
-
-# 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.coffee
- - helpers/**/*.js
- - fixtures/**/*.js.coffee
-
-# 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.coffee"
-
-# 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:
@@ -1,31 +0,0 @@
-require 'rack/coffee_compiler'
-require 'erb'
-
-# based on https://github.com/jbaudanza/rack-asset-compiler/blob/master/examples/jasmine_config.rb
-module Jasmine
- class Config
- alias_method :old_js_files, :js_files
-
- def js_files(spec_filter = nil)
- # Convert all .js.coffee files into .js files before putting them in a script tag
- old_js_files(spec_filter).map do |filename|
- filename.sub(/\.js\.coffee/, '.js')
- end
- end
- 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
@@ -1,49 +0,0 @@
-$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
-
-require 'rubygems'
-require 'jasmine'
-jasmine_config_overrides = File.expand_path(File.join(Dir.pwd, 'spec', 'javascripts', 'support', 'jasmine_config.rb'))
-require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
-if Jasmine::Dependencies.rspec2?
- require 'rspec'
-else
- require 'spec'
-end
-
-jasmine_runner_config = Jasmine::RunnerConfig.new
-root_path = jasmine_runner_config.project_root
-
-app = Jasmine::Application.app(jasmine_runner_config)
-
-# TODO dry it
-app = Rack::Builder.new(app) do |app|
- app.use Rack::CoffeeCompiler,
- source_extension: 'js.coffee',
- source_dir: File.join(root_path, 'spec/javascripts'),
- url: jasmine_runner_config.spec_path
-
- app.use Rack::CoffeeCompiler,
- source_extension: 'js.coffee',
- source_dir: File.join(root_path, 'app/assets/javascripts'),
- url: '/app/assets/javascripts'
-end
-
-server = Jasmine::Server.new(jasmine_runner_config.port, app)
-client = Jasmine::SeleniumDriver.new(jasmine_runner_config.browser,
- "#{jasmine_runner_config.jasmine_host}:#{jasmine_runner_config.port}/")
-
-t = Thread.new do
- begin
- server.start
- rescue ChildProcess::TimeoutError
- end
- # # ignore bad exits
-end
-t.abort_on_exception = true
-Jasmine::wait_for_listener(jasmine_runner_config.port, "jasmine server")
-puts "jasmine server started."
-
-results_processor = Jasmine::ResultsProcessor.new(jasmine_runner_config)
-results = Jasmine::Runners::HTTP.new(client, results_processor).run
-formatter = Jasmine::RspecFormatter.new
-formatter.format_results(results)

0 comments on commit b09b660

Please sign in to comment.