jasmine 1.0.2.1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +0 -3
  3. data/README.markdown +7 -1
  4. data/Rakefile +10 -24
  5. data/generators/jasmine/templates/jasmine-example/SpecRunner.html +40 -13
  6. data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +3 -3
  7. data/jasmine.gemspec +18 -8
  8. data/lib/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -2
  9. data/lib/jasmine/base.rb +9 -6
  10. data/lib/jasmine/command_line_tool.rb +1 -1
  11. data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
  12. data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
  13. data/lib/jasmine/firebug/firebug-license.txt +30 -0
  14. data/lib/jasmine/firebug/firebug.rb +30 -0
  15. data/lib/jasmine/selenium_driver.rb +8 -2
  16. data/lib/jasmine/server.rb +4 -7
  17. data/lib/jasmine/tasks/jasmine.rake +15 -6
  18. data/lib/jasmine/version.rb +1 -1
  19. data/spec/fixture/Rakefile +4 -0
  20. data/spec/fixture/spec/example_spec.js +5 -0
  21. data/spec/fixture/src/example.js +3 -0
  22. data/spec/jasmine_command_line_tool_rakeless_spec.rb +20 -0
  23. data/spec/jasmine_rails2_spec.rb +1 -1
  24. data/spec/jasmine_self_test_config.rb +6 -2
  25. data/spec/jasmine_self_test_spec.rb +0 -1
  26. data/spec/server_spec.rb +12 -11
  27. metadata +39 -92
  28. data/.gitmodules +0 -3
  29. data/jasmine/Gemfile +0 -6
  30. data/jasmine/HowToRelease.markdown +0 -29
  31. data/jasmine/MIT.LICENSE +0 -20
  32. data/jasmine/README.markdown +0 -50
  33. data/jasmine/Rakefile +0 -166
  34. data/jasmine/cruise_config.rb +0 -21
  35. data/jasmine/example/SpecRunner.html +0 -27
  36. data/jasmine/example/spec/PlayerSpec.js +0 -58
  37. data/jasmine/example/spec/SpecHelper.js +0 -9
  38. data/jasmine/example/src/Player.js +0 -22
  39. data/jasmine/example/src/Song.js +0 -7
  40. data/jasmine/images/jasmine_favicon.png +0 -0
  41. data/jasmine/jsdoc-template/allclasses.tmpl +0 -17
  42. data/jasmine/jsdoc-template/allfiles.tmpl +0 -56
  43. data/jasmine/jsdoc-template/class.tmpl +0 -646
  44. data/jasmine/jsdoc-template/index.tmpl +0 -39
  45. data/jasmine/jsdoc-template/publish.js +0 -184
  46. data/jasmine/jsdoc-template/static/default.css +0 -162
  47. data/jasmine/jsdoc-template/static/header.html +0 -2
  48. data/jasmine/jsdoc-template/static/index.html +0 -19
  49. data/jasmine/jsdoc-template/symbol.tmpl +0 -35
  50. data/jasmine/jshint/jshint.js +0 -5919
  51. data/jasmine/jshint/run.js +0 -98
  52. data/jasmine/lib/jasmine-html.js +0 -190
  53. data/jasmine/lib/jasmine.css +0 -166
  54. data/jasmine/lib/jasmine.js +0 -2445
  55. data/jasmine/lib/json2.js +0 -478
  56. data/jasmine/spec/node_suite.js +0 -233
  57. data/jasmine/spec/runner.html +0 -82
  58. data/jasmine/spec/suites/BaseSpec.js +0 -27
  59. data/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
  60. data/jasmine/spec/suites/EnvSpec.js +0 -158
  61. data/jasmine/spec/suites/ExceptionsSpec.js +0 -107
  62. data/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
  63. data/jasmine/spec/suites/MatchersSpec.js +0 -795
  64. data/jasmine/spec/suites/MockClockSpec.js +0 -38
  65. data/jasmine/spec/suites/MultiReporterSpec.js +0 -45
  66. data/jasmine/spec/suites/NestedResultsSpec.js +0 -54
  67. data/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
  68. data/jasmine/spec/suites/QueueSpec.js +0 -23
  69. data/jasmine/spec/suites/ReporterSpec.js +0 -56
  70. data/jasmine/spec/suites/RunnerSpec.js +0 -267
  71. data/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
  72. data/jasmine/spec/suites/SpecSpec.js +0 -124
  73. data/jasmine/spec/suites/SpySpec.js +0 -201
  74. data/jasmine/spec/suites/SuiteSpec.js +0 -120
  75. data/jasmine/spec/suites/TrivialConsoleReporterSpec.js +0 -431
  76. data/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
  77. data/jasmine/spec/suites/UtilSpec.js +0 -39
  78. data/jasmine/spec/suites/WaitsForBlockSpec.js +0 -118
  79. data/jasmine/src/Block.js +0 -22
  80. data/jasmine/src/Env.js +0 -264
  81. data/jasmine/src/JsApiReporter.js +0 -102
  82. data/jasmine/src/Matchers.js +0 -354
  83. data/jasmine/src/MultiReporter.js +0 -35
  84. data/jasmine/src/NestedResults.js +0 -80
  85. data/jasmine/src/PrettyPrinter.js +0 -123
  86. data/jasmine/src/Queue.js +0 -99
  87. data/jasmine/src/Reporter.js +0 -31
  88. data/jasmine/src/Runner.js +0 -77
  89. data/jasmine/src/Spec.js +0 -242
  90. data/jasmine/src/Suite.js +0 -82
  91. data/jasmine/src/WaitsBlock.js +0 -15
  92. data/jasmine/src/WaitsForBlock.js +0 -54
  93. data/jasmine/src/base.js +0 -608
  94. data/jasmine/src/console/TrivialConsoleReporter.js +0 -144
  95. data/jasmine/src/html/TrivialReporter.js +0 -190
  96. data/jasmine/src/html/jasmine.css +0 -166
  97. data/jasmine/src/mock-timeout.js +0 -183
  98. data/jasmine/src/util.js +0 -67
  99. data/jasmine/src/version.json +0 -5
data/.gitignore CHANGED
@@ -7,5 +7,6 @@ bin
7
7
  .rvmrc
8
8
  .pairs
9
9
  *.swp
10
+ tags
10
11
  Gemfile.lock
11
12
  spec/reports
data/Gemfile CHANGED
@@ -1,5 +1,2 @@
1
1
  source "http://rubygems.org"
2
-
3
- # dependencies are specified in jasmine.gemspec
4
-
5
2
  gemspec
@@ -34,7 +34,13 @@ Start the Jasmine server:
34
34
 
35
35
  `rake jasmine`
36
36
 
37
- Point your browser to `localhost:8888`. The suite will run every time this page is re-loaded.
37
+ Point your browser to `localhost:8888`. The suite will run every time this page is re-loaded.
38
+
39
+ Start Jasmine on a different port:
40
+
41
+ `rake jasmine JASMINE_PORT=1337`
42
+
43
+ Point your browser to `localhost:1337`.
38
44
 
39
45
  For Continuous Integration environments, add this task to the project build steps:
40
46
 
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
3
3
  require "bundler"
4
4
  Bundler.setup
5
+ Bundler::GemHelper.install_tasks
5
6
 
6
7
  def rspec2?
7
8
  Gem.available? "rspec", ">= 2.0"
@@ -23,7 +24,7 @@ require 'ci/reporter/rake/rspec'
23
24
  desc "Run all examples"
24
25
  if rspec2?
25
26
  RSpec::Core::RakeTask.new(:spec) do |t|
26
- t.pattern = 'spec/**/*.rb'
27
+ t.pattern = 'spec/**/*_spec.rb'
27
28
  end
28
29
  else
29
30
  Spec::Rake::SpecTask.new('spec') do |t|
@@ -31,46 +32,31 @@ else
31
32
  end
32
33
  end
33
34
 
34
- task :spec => ['jasmine:copy_examples_to_gem', 'bundle_install', 'ci:setup:rspec']
35
-
36
- task :spex do
37
- `bundle install`
38
- Rake::Task["spec"].invoke
39
- end
35
+ task :spec => ['jasmine:copy_examples_to_gem', 'ci:setup:rspec']
40
36
 
41
37
  task :default => :spec
42
38
 
43
39
  namespace :jasmine do
40
+ require "jasmine-core"
44
41
  require './spec/jasmine_self_test_config'
45
- task :server do
46
- puts "your tests are here:"
47
- puts " http://localhost:8888/"
42
+ task :server do
43
+ port = ENV['JASMINE_PORT'] || 8888
44
+ JasmineSelfTestConfig.new.start_server(port)
48
45
 
49
- JasmineSelfTestConfig.new.start_server
46
+ puts "your tests are here:"
47
+ puts " http://localhost:#{port}/"
50
48
  end
51
49
 
52
50
  desc "Copy examples from Jasmine JS to the gem"
53
51
  task :copy_examples_to_gem do
54
- unless File.exist?('jasmine/lib')
55
- raise "Jasmine submodule isn't present. Run git submodule update --init"
56
- end
57
-
58
52
  require "fileutils"
59
53
 
60
54
  # copy jasmine's example tree into our generator templates dir
61
55
  FileUtils.rm_r('generators/jasmine/templates/jasmine-example', :force => true)
62
- FileUtils.cp_r('jasmine/example', 'generators/jasmine/templates/jasmine-example', :preserve => true)
56
+ FileUtils.cp_r(File.join(Jasmine::Core.path, 'example'), 'generators/jasmine/templates/jasmine-example', :preserve => true)
63
57
  end
64
58
  end
65
59
 
66
60
  desc "Run specs via server"
67
61
  task :jasmine => ['jasmine:server']
68
62
 
69
- desc "Install Bundle"
70
- task "bundle_install" do
71
- `bundle install`
72
- end
73
-
74
-
75
- require 'bundler'
76
- Bundler::GemHelper.install_tasks
@@ -2,26 +2,53 @@
2
2
  "http://www.w3.org/TR/html4/loose.dtd">
3
3
  <html>
4
4
  <head>
5
- <title>Jasmine Test Runner</title>
6
- <link rel="stylesheet" type="text/css" href="lib/jasmine-##JASMINE_VERSION##/jasmine.css">
7
- <script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/jasmine.js"></script>
8
- <script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/jasmine-html.js"></script>
5
+ <title>Jasmine Spec Runner</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="lib/jasmine-1.1.0.rc1/jasmine_favicon.png">
8
+
9
+ <link rel="stylesheet" type="text/css" href="lib/jasmine-1.1.0.rc1/jasmine.css">
10
+ <script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine.js"></script>
11
+ <script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine-html.js"></script>
9
12
 
10
13
  <!-- include source files here... -->
14
+ <script type="text/javascript" src="spec/SpecHelper.js"></script>
15
+ <script type="text/javascript" src="spec/PlayerSpec.js"></script>
16
+
17
+ <!-- include spec files here... -->
11
18
  <script type="text/javascript" src="src/Player.js"></script>
12
19
  <script type="text/javascript" src="src/Song.js"></script>
13
20
 
14
- <!-- include spec files here... -->
15
- <script type="text/javascript" src="spec/SpecHelper.js"></script>
16
- <script type="text/javascript" src="spec/PlayerSpec.js"></script>
21
+ <script type="text/javascript">
22
+ (function() {
23
+ var jasmineEnv = jasmine.getEnv();
24
+ jasmineEnv.updateInterval = 1000;
25
+
26
+ var trivialReporter = new jasmine.TrivialReporter();
27
+
28
+ jasmineEnv.addReporter(trivialReporter);
29
+
30
+ jasmineEnv.specFilter = function(spec) {
31
+ return trivialReporter.specFilter(spec);
32
+ };
33
+
34
+ var currentWindowOnload = window.onload;
35
+
36
+ window.onload = function() {
37
+ if (currentWindowOnload) {
38
+ currentWindowOnload();
39
+ }
40
+ execJasmine();
41
+ };
42
+
43
+ function execJasmine() {
44
+ jasmineEnv.execute();
45
+ }
46
+
47
+ })();
48
+ </script>
17
49
 
18
50
  </head>
19
- <body>
20
- <div id="REMOVE_THIS_LINE_FROM_BUILD"><p>You must be trying to look at examples in the Jasmine source tree.</p><p>Please download a distribution version of Jasmine at <a href="http://pivotal.github.com/jasmine/">http://pivotal.github.com/jasmine/</a>.</p></div>
21
- <script type="text/javascript">
22
- jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
23
- jasmine.getEnv().execute();
24
- </script>
25
51
 
52
+ <body>
26
53
  </body>
27
54
  </html>
@@ -2,8 +2,8 @@ beforeEach(function() {
2
2
  this.addMatchers({
3
3
  toBePlaying: function(expectedSong) {
4
4
  var player = this.actual;
5
- return player.currentlyPlayingSong === expectedSong
6
- && player.isPlaying;
5
+ return player.currentlyPlayingSong === expectedSong &&
6
+ player.isPlaying;
7
7
  }
8
- })
8
+ });
9
9
  });
@@ -20,32 +20,42 @@ Gem::Specification.new do |s|
20
20
  s.rdoc_options = ["--charset=UTF-8"]
21
21
 
22
22
  if ENV['RAILS_VERSION'] == 'pojs-rspec1'
23
- s.add_development_dependency 'rspec', '1.3.1'
23
+ if ENV["RUBY_VERSION"] =~ /1\.8\.6/
24
+ #1.3.2 buffer overflows
25
+ s.add_development_dependency 'rspec', '= 1.3.1'
26
+ s.add_development_dependency 'rack', "1.1"
27
+ else
28
+ s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
29
+ end
24
30
  s.add_development_dependency 'rake-tasks'
25
- s.add_development_dependency 'rack', "1.1" if ENV["RUBY_VERSION"] =~ /1\.8\.6/
26
31
  elsif ENV['RAILS_VERSION'] == 'pojs-rspec2'
27
32
  s.add_development_dependency 'rspec', '>= 2.5.0'
28
33
  s.add_development_dependency 'rake-tasks'
29
34
  s.add_development_dependency 'rack', "1.1" if ENV["RUBY_VERSION"] =~ /1\.8\.6/
30
35
  elsif ENV['RAILS_VERSION'] == 'rails2'
36
+ if ENV["RUBY_VERSION"] =~ /1\.8\.6/
37
+ #1.3.2 buffer overflows
38
+ s.add_development_dependency 'rspec', '= 1.3.1'
39
+ else
40
+ s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
41
+ end
31
42
  # for development & test of Rails 2 Generators
32
- s.add_development_dependency 'rspec', '1.3.1'
33
- s.add_development_dependency 'rails', '2.3.11'
34
- s.add_development_dependency 'rack', '1.1'
43
+ s.add_development_dependency 'rails', '2.3.11', "< 3"
44
+ s.add_development_dependency 'rack', '>= 1.1', "< 1.2"
35
45
  else
36
46
  # for development & test of Rails 3 Generators
37
47
  s.add_development_dependency 'rspec', '>= 2.5.0'
38
- s.add_development_dependency 'rails', '>= 3.0.3 '
48
+ s.add_development_dependency 'rails', '>= 3.0.0'
39
49
  s.add_development_dependency 'rack', '>= 1.2.1'
40
50
  end
41
51
 
42
52
  s.add_development_dependency 'rack-test'
43
53
  s.add_development_dependency 'gem-release', ">= 0.0.16"
44
54
  s.add_development_dependency 'ci_reporter'
55
+ s.add_development_dependency 'json_pure'
45
56
 
57
+ s.add_dependency 'jasmine-core', ">= 1.1.0.rc2"
46
58
  s.add_dependency 'rack', '>= 1.1'
47
59
  s.add_dependency 'rspec', '>= 1.3.1'
48
- s.add_dependency 'json_pure', '>= 1.4.3'
49
60
  s.add_dependency 'selenium-webdriver', '>= 0.1.3'
50
-
51
61
  end
@@ -1,2 +1,8 @@
1
- require 'jasmine'
2
- load 'jasmine/tasks/jasmine.rake'
1
+ begin
2
+ require 'jasmine'
3
+ load 'jasmine/tasks/jasmine.rake'
4
+ rescue LoadError
5
+ task :jasmine do
6
+ abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
7
+ end
8
+ end
@@ -2,10 +2,6 @@ require 'socket'
2
2
  require 'erb'
3
3
 
4
4
  module Jasmine
5
- def self.root
6
- ENV["JASMINE_ROOT"] || File.expand_path(File.join(File.dirname(__FILE__), '../../jasmine'))
7
- end
8
-
9
5
  # this seemingly-over-complex method is necessary to get an open port on at least some of our Macs
10
6
  def self.open_socket_on_unused_port
11
7
  infos = Socket::getaddrinfo("localhost", nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
@@ -57,10 +53,17 @@ module Jasmine
57
53
  end
58
54
 
59
55
  def self.rspec2?
56
+ Gem::Specification::find_by_name "rspec", ">= 2.0"
57
+ rescue
60
58
  Gem.available? "rspec", ">= 2.0"
61
59
  end
62
-
60
+
63
61
  def self.rails3?
64
- Gem.available? "rails", ">= 3.0"
62
+ return Rails.version.split(".").first.to_i == 3 if defined? Rails
63
+ begin
64
+ Gem::Specification::find_by_name "rails", ">= 3.0"
65
+ rescue
66
+ Gem.available? "rails", ">= 3.0"
67
+ end
65
68
  end
66
69
  end
@@ -44,13 +44,13 @@ module Jasmine
44
44
  copy_unless_exists('spec/javascripts/support/jasmine-rails.yml', 'spec/javascripts/support/jasmine.yml')
45
45
  else
46
46
  copy_unless_exists('spec/javascripts/support/jasmine.yml')
47
+ require 'rake'
47
48
  write_mode = 'w'
48
49
  if File.exist?(dest_path('Rakefile'))
49
50
  load dest_path('Rakefile')
50
51
  write_mode = 'a'
51
52
  end
52
53
 
53
- require 'rake'
54
54
  unless Rake::Task.task_defined?('jasmine')
55
55
  File.open(dest_path('Rakefile'), write_mode) do |f|
56
56
  f.write("\n" + File.read(template_path('lib/tasks/jasmine.rake')))
@@ -0,0 +1,30 @@
1
+ Software License Agreement (BSD License)
2
+
3
+ Copyright (c) 2007, Parakey Inc.
4
+ All rights reserved.
5
+
6
+ Redistribution and use of this software in source and binary forms, with or without modification,
7
+ are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above
10
+ copyright notice, this list of conditions and the
11
+ following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above
14
+ copyright notice, this list of conditions and the
15
+ following disclaimer in the documentation and/or other
16
+ materials provided with the distribution.
17
+
18
+ * Neither the name of Parakey Inc. nor the names of its
19
+ contributors may be used to endorse or promote products
20
+ derived from this software without specific prior
21
+ written permission of Parakey Inc.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
24
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
25
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,30 @@
1
+ require 'selenium/webdriver'
2
+
3
+ class Selenium::WebDriver::Firefox::Profile
4
+ def self.firebug_version
5
+ @firebug_version ||= '1.6.2'
6
+ end
7
+
8
+ def self.firebug_version=(version)
9
+ @firebug_version = version
10
+ end
11
+
12
+ def enable_firebug(version = nil)
13
+ version ||= Selenium::WebDriver::Firefox::Profile.firebug_version
14
+ add_extension(File.expand_path("../firebug-#{version}.xpi", __FILE__))
15
+
16
+ # Prevent "Welcome!" tab
17
+ self["extensions.firebug.currentVersion"] = "999"
18
+
19
+ # Enable for all sites.
20
+ self["extensions.firebug.allPagesActivation"] = "on"
21
+
22
+ # Enable all features.
23
+ ['console', 'net', 'script'].each do |feature|
24
+ self["extensions.firebug.#{feature}.enableSites"] = true
25
+ end
26
+
27
+ # Open by default.
28
+ self["extensions.firebug.previousPlacement"] = 1
29
+ end
30
+ end
@@ -7,10 +7,16 @@ module Jasmine
7
7
  elsif ENV['SELENIUM_SERVER_PORT']
8
8
  "http://localhost:#{ENV['SELENIUM_SERVER_PORT']}/wd/hub"
9
9
  end
10
+ options = if browser == "firefox" && ENV["JASMINE_FIREBUG"]
11
+ require File.join(File.dirname(__FILE__), "firebug/firebug")
12
+ profile = Selenium::WebDriver::Firefox::Profile.new
13
+ profile.enable_firebug
14
+ {:profile => profile}
15
+ end || {}
10
16
  @driver = if selenium_server
11
17
  Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => browser.to_sym
12
18
  else
13
- Selenium::WebDriver.for browser.to_sym
19
+ Selenium::WebDriver.for browser.to_sym, options
14
20
  end
15
21
  @http_address = http_address
16
22
  end
@@ -46,4 +52,4 @@ module Jasmine
46
52
  JSON.generate(obj)
47
53
  end
48
54
  end
49
- end
55
+ end
@@ -1,15 +1,12 @@
1
1
  require 'rack'
2
+ require 'jasmine-core'
2
3
 
3
4
  module Jasmine
4
5
  class RunAdapter
5
6
  def initialize(config)
6
7
  @config = config
7
- @jasmine_files = [
8
- "/__JASMINE_ROOT__/lib/jasmine.js",
9
- "/__JASMINE_ROOT__/lib/jasmine-html.js",
10
- "/__JASMINE_ROOT__/lib/json2.js",
11
- ]
12
- @jasmine_stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"]
8
+ @jasmine_files = Jasmine::Core.js_files.map {|f| "/__JASMINE_ROOT__/#{f}"}
9
+ @jasmine_stylesheets = Jasmine::Core.css_files.map {|f| "/__JASMINE_ROOT__/#{f}"}
13
10
  end
14
11
 
15
12
  def call(env)
@@ -81,7 +78,7 @@ module Jasmine
81
78
  map('/run.html') { run Jasmine::Redirect.new('/') }
82
79
  map('/__suite__') { run Jasmine::FocusedSuite.new(config) }
83
80
 
84
- map('/__JASMINE_ROOT__') { run Rack::File.new(Jasmine.root) }
81
+ map('/__JASMINE_ROOT__') { run Rack::File.new(Jasmine::Core.path) }
85
82
  map(config.spec_path) { run Rack::File.new(config.spec_dir) }
86
83
  map(config.root_path) { run Rack::File.new(config.project_root) }
87
84
 
@@ -3,8 +3,17 @@ namespace :jasmine do
3
3
  require 'jasmine'
4
4
  end
5
5
 
6
+ task :require_json do
7
+ begin
8
+ require 'json'
9
+ rescue LoadError
10
+ puts "You must have a JSON library installed to run jasmine:ci. Try \"gem install json\""
11
+ exit
12
+ end
13
+ end
14
+
6
15
  desc "Run continuous integration tests"
7
- task :ci => "jasmine:require" do
16
+ task :ci => ["jasmine:require_json", "jasmine:require"] do
8
17
  if Jasmine::rspec2?
9
18
  require "rspec"
10
19
  require "rspec/core/rake_task"
@@ -15,13 +24,13 @@ namespace :jasmine do
15
24
 
16
25
  if Jasmine::rspec2?
17
26
  RSpec::Core::RakeTask.new(:jasmine_continuous_integration_runner) do |t|
18
- t.rspec_opts = ["--colour", "--format", "progress"]
27
+ t.rspec_opts = ["--colour", "--format", ENV['JASMINE_SPEC_FORMAT'] || "progress"]
19
28
  t.verbose = true
20
29
  t.pattern = ['spec/javascripts/support/jasmine_runner.rb']
21
30
  end
22
31
  else
23
32
  Spec::Rake::SpecTask.new(:jasmine_continuous_integration_runner) do |t|
24
- t.spec_opts = ["--color", "--format", "specdoc"]
33
+ t.spec_opts = ["--color", "--format", ENV['JASMINE_SPEC_FORMAT'] || "specdoc"]
25
34
  t.verbose = true
26
35
  t.spec_files = ['spec/javascripts/support/jasmine_runner.rb']
27
36
  end
@@ -33,10 +42,10 @@ namespace :jasmine do
33
42
  jasmine_config_overrides = './spec/javascripts/support/jasmine_config.rb'
34
43
  require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
35
44
 
45
+ port = ENV['JASMINE_PORT'] || 8888
36
46
  puts "your tests are here:"
37
- puts " http://localhost:8888/"
38
-
39
- Jasmine::Config.new.start_server
47
+ puts " http://localhost:#{port}/"
48
+ Jasmine::Config.new.start_server(port)
40
49
  end
41
50
  end
42
51