Documentation and example fixes

This commit is contained in:
bigfix 2010-04-20 07:26:04 -07:00 committed by ragaskar
parent 9f8d18b6b7
commit 5cfb019b6b
10 changed files with 205 additions and 361 deletions

View File

@ -5,24 +5,11 @@ Jasmine
Quick Start
----------
### Ruby Suite Running
1. Get the latest release from the [downloads page](http://github.com/pivotal/jasmine/downloads).
2. Open `example/example_runner.html` in your favorite browser.
Please use the [jasmine-ruby gem](http://github.com/pivotal/jasmine-ruby) to run suites in a ruby environment.
### HTML Suite Running
[Get the latest release from the downloads page](http://github.com/pivotal/jasmine/downloads)
Open `example/example_runner.html` in your favorite browser.
### Automatic Suite Running (w/ Selenium)
sudo gem sources -a http://gems.github.com
sudo gem install geminstaller
git clone git://github.com/pivotal/jasmine.git
cd jasmine
sudo geminstaller
cd examples/ruby
rake test:ci
For running within a Ruby environment, including automated execution with Selenium, please use
the [jasmine-ruby gem](http://github.com/pivotal/jasmine-ruby).
Releases
----------

View File

@ -0,0 +1,24 @@
<!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.10.3.js"></script>
<script type="text/javascript" src="../lib/TrivialReporter.js"></script>
<script type="text/javascript" src="../lib/consolex.js"></script>
<script type="text/javascript" src="spec/example_suite.js"></script>
<link rel="stylesheet" type="text/css" href="../lib/jasmine.css">
<body>
<script type="text/javascript">
var jasmineEnv = jasmine.getEnv();
jasmineEnv.reporter = new jasmine.TrivialReporter();
jasmineEnv.execute();
</script>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!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.10.1.js"></script>
<script type="text/javascript" src="../../lib/TrivialReporter.js"></script>
<script type="text/javascript" src="../../lib/consolex.js"></script>
<link rel="stylesheet" type="text/css" href="../../lib/jasmine.css">
<script type="text/javascript">
jasmine.include('spec/example_suite.js', true);
</script>
<body>
<script type="text/javascript">
var jasmineEnv = jasmine.getEnv();
jasmineEnv.reporter = new jasmine.TrivialReporter();
jasmineEnv.execute();
</script>
</body>
</html>

View File

@ -1,33 +0,0 @@
require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb"))
namespace :test do
desc "Run continuous integration tests"
task :ci => :'ci:local'
namespace :ci do
require "spec"
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:local) do |t|
t.spec_opts = ["--color", "--format", "specdoc"]
t.spec_files = ["spec/jasmine_spec.rb"]
end
desc "Run continuous integration tests using Sauce Labs 'Selenium in the Cloud'"
task :saucelabs do
ENV['SAUCELABS'] = 'true'
Rake::Task['test:ci:local'].invoke
end
end
end
desc "Run specs via server"
task :jasmine_server do
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
puts "your tests are here:"
puts " http://localhost:8888/run.html"
Jasmine::SimpleServer.start(8888,
lambda { JasmineHelper.specs },
JasmineHelper.dir_mappings)
end

View File

@ -1,11 +0,0 @@
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);
});
});
});

View File

@ -1,41 +0,0 @@
class JasmineHelper
def self.jasmine_lib_dir
File.expand_path(File.join(jasmine_root, 'lib'))
end
def self.jasmine_root
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
end
def self.jasmine
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
['/lib/json2.js',
'/lib/TrivialReporter.js',
'/lib/consolex.js'
]
end
def self.jasmine_src_dir
File.expand_path(File.join(jasmine_root, 'src'))
end
def self.jasmine_spec_dir
File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec'))
end
def self.raw_spec_files
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
end
def self.specs
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
end
def self.dir_mappings
{
"/src" => jasmine_src_dir,
"/spec" => jasmine_spec_dir,
"/lib" => jasmine_lib_dir
}
end
end

View File

@ -1,31 +0,0 @@
require 'rubygems'
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
jasmine_runner = if ENV['SAUCELABS'] == 'true'
require 'sauce_tunnel'
require 'selenium_config'
Jasmine::SauceLabsRunner.new(JasmineHelper.specs,
JasmineHelper.dir_mappings,
:saucelabs_config => 'saucelabs',
:saucelabs_config_file => File.expand_path(File.join(File.dirname(__FILE__), "saucelabs.yml")))
else
require "selenium_rc"
Jasmine::Runner.new(SeleniumRC::Server.new('localhost').jar_path,
JasmineHelper.specs,
JasmineHelper.dir_mappings)
end
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_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

View File

@ -1,24 +0,0 @@
local:
application_framework: :selenium
#
# Possible Sauce Labs configurations as of 2009/11/19
# From: http://saucelabs.com/products/docs/sauce-ondemand/browsers
# os: "Windows 2003"
# browser: "iexplore"
# browser-version: "6.", "7.", "8."
# browser: "firefox"
# browser-version: "2.", "3.0", "3.5"
# browser: "safari"
# browser-version: "3.", "4."
# browser: "opera"
# browser-version: "9."
# browser: "googlechrome"
# browser-version: ""
# os: "Linux"
# browser: "firefox"
# browser-version: "3."
saucelabs:
application_framework: :external
selenium_server_address: "saucelabs.com"
selenium_browser_key: '{"username": "--YOUR-SAUCELABS-USERNAME--", "access-key": "--YOUR-SAUCELABS-ACCESS-KEY--", "os": "Linux", "browser": "firefox", "browser-version": "3."}'
application_port: "80"