Use jasmine-gem for jasmine-core tests

This commit is contained in:
Davis W. Frank & Rajan Agaskar
2012-11-28 14:25:39 -08:00
parent 867de62699
commit b94522193c
6 changed files with 91 additions and 3 deletions

View File

@@ -1,3 +1,11 @@
source :rubygems
gem "rake"
gem "jasmine", git: 'https://github.com/pivotal/jasmine-gem.git'
unless ENV["TRAVIS"]
group :debug do
gem 'debugger'
end
end
gemspec

View File

@@ -41,4 +41,40 @@ desc "View full development tasks"
task :list_dev_tasks do
puts "Jasmine uses Thor for command line tasks for development. Here is the command set:"
system "thor list"
end
end
require "jasmine"
require 'rspec'
require 'rspec/core/rake_task'
desc "Run all examples"
RSpec::Core::RakeTask.new(:jasmine_core_spec) do |t|
t.pattern = 'spec/jasmine_self_test_spec.rb'
end
namespace :jasmine do
task :server do
port = ENV['JASMINE_PORT'] || 8888
Jasmine.load_configuration_from_yaml(File.join(Dir.pwd, 'spec', 'jasmine.yml'))
config = Jasmine.config
server = Jasmine::Server.new(8888, Jasmine::Application.app(config))
server.start
puts "your tests are here:"
puts " http://localhost:#{port}/"
end
desc "Copy examples from Jasmine JS to the gem"
task :copy_examples_to_gem do
require "fileutils"
# copy jasmine's example tree into our generator templates dir
FileUtils.rm_r('generators/jasmine/templates/jasmine-example', :force => true)
FileUtils.cp_r(File.join(Jasmine::Core.path, 'example'), 'generators/jasmine/templates/jasmine-example', :preserve => true)
end
end
desc "Run specs via server"
task :jasmine => ['jasmine:server']

View File

@@ -2596,5 +2596,5 @@ jasmine.version_= {
"major": 1,
"minor": 3,
"build": 0,
"revision": 1354052693
"revision": 1354127958
};

21
spec/jasmine.yml Normal file
View File

@@ -0,0 +1,21 @@
jasmine_dir:
- 'src'
jasmine_files:
- 'core/base.js'
- 'core/util.js'
- 'core/Reporter.js'
- 'html/HtmlReporterHelpers.js'
- '**/*.js'
jasmine_css_files:
- 'html/jasmine.css'
src_files:
stylesheets:
helpers:
- 'helpers/**/*.js'
spec_files:
- '**/*[sS]pec.js'
src_dir:
spec_dir:
- 'spec'

View File

@@ -0,0 +1,23 @@
require 'jasmine'
Jasmine.load_configuration_from_yaml(File.join(Dir.pwd, 'spec', 'jasmine.yml'))
config = Jasmine.config
server = Jasmine::Server.new(config.port, Jasmine::Application.app(config))
driver = Jasmine::SeleniumDriver.new(config.browser, "#{config.host}:#{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(config.port, "jasmine server")
puts "jasmine server started."
results_processor = Jasmine::ResultsProcessor.new(config)
results = Jasmine::Runners::HTTP.new(driver, results_processor, config.result_batch_size).run
formatter = Jasmine::RspecFormatter.new
formatter.format_results(results)

View File

@@ -3,5 +3,5 @@ jasmine.version_= {
"major": 1,
"minor": 3,
"build": 0,
"revision": 1354052693
"revision": 1354127999
};