Reorg. Added examples/ with html and ruby test runner examples
This commit is contained in:
26
examples/html/example_suite.html
Normal file
26
examples/html/example_suite.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Jasmine Test Runner</title>
|
||||
</head>
|
||||
<script type="text/javascript" src="../../lib/jasmine-0.9.0.js"></script>
|
||||
<script type="text/javascript" src="../../lib/TrivialReporter.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../lib/jasmine.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
jasmine.include('example_suite.js', true);
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var jasmineEnv = jasmine.getEnv();
|
||||
jasmineEnv.reporter = new jasmine.TrivialReporter();
|
||||
jasmineEnv.execute();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
11
examples/html/spec/example_suite.js
Normal file
11
examples/html/spec/example_suite.js
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('ExampleSuite', function () {
|
||||
it('should have a passing test', function() {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
describe('Nested Describe', function () {
|
||||
it('should also have a passing test', function () {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
32
examples/ruby/Rakefile
Normal file
32
examples/ruby/Rakefile
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace :test do
|
||||
desc "Run continuous integration tests"
|
||||
require "spec"
|
||||
require 'spec/rake/spectask'
|
||||
|
||||
Spec::Rake::SpecTask.new(:ci) do |t|
|
||||
t.spec_opts = ["--color", "--format", "specdoc"]
|
||||
t.spec_files = ["spec/jasmine_spec.rb"]
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run specs via server"
|
||||
task :jasmine_server do
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), "../../contrib/ruby/jasmine_spec_builder"))
|
||||
|
||||
JASMINE_LIB = File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))
|
||||
dir_mappings = {
|
||||
"/spec" => 'spec',
|
||||
"/lib" => JASMINE_LIB
|
||||
}
|
||||
|
||||
includes = ['lib/' + File.basename(Dir.glob("#{JASMINE_LIB}/jasmine*.js").first),
|
||||
'lib/json2.js',
|
||||
'lib/TrivialReporter.js']
|
||||
|
||||
spec_files = Dir.glob("spec/**/*[Ss]pec.js")
|
||||
|
||||
puts "your tests are here:"
|
||||
puts " http://localhost:8888/run.html"
|
||||
|
||||
Jasmine::SimpleServer.start(8888, includes + spec_files, dir_mappings)
|
||||
end
|
||||
11
examples/ruby/spec/example/example_spec.js
Normal file
11
examples/ruby/spec/example/example_spec.js
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('ExampleSuite', function () {
|
||||
it('should have a passing test', function() {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
describe('Nested Describe', function () {
|
||||
it('should also have a passing test', function () {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
30
examples/ruby/spec/jasmine_spec.rb
Normal file
30
examples/ruby/spec/jasmine_spec.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require 'rubygems'
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), "../../../contrib/ruby/jasmine_spec_builder"))
|
||||
require "selenium_rc"
|
||||
|
||||
|
||||
JASMINE_LIB = File.expand_path(File.join(File.dirname(__FILE__), '../../../lib'))
|
||||
dir_mappings = {
|
||||
"/spec" => 'spec',
|
||||
"/lib" => JASMINE_LIB
|
||||
}
|
||||
|
||||
includes = ['lib/' + File.basename(Dir.glob("#{JASMINE_LIB}/jasmine*.js").first),
|
||||
'lib/json2.js',
|
||||
'lib/TrivialReporter.js']
|
||||
|
||||
spec_files = Dir.glob("spec/**/*[Ss]pec.js")
|
||||
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path, includes + spec_files, dir_mappings)
|
||||
spec_builder = Jasmine::SpecBuilder.new(spec_files, jasmine_runner)
|
||||
|
||||
should_stop = false
|
||||
|
||||
Spec::Runner.configure do |config|
|
||||
config.after(:suite) do
|
||||
spec_builder.stop if should_stop
|
||||
end
|
||||
end
|
||||
|
||||
spec_builder.start
|
||||
should_stop = true
|
||||
spec_builder.declare_suites
|
||||
Reference in New Issue
Block a user