jasmine 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -11
  3. data/Gemfile +4 -2
  4. data/HOW_TO_TEST.markdown +1 -1
  5. data/README.markdown +23 -14
  6. data/RELEASE.markdown +6 -13
  7. data/Rakefile +21 -23
  8. data/jasmine.gemspec +9 -16
  9. data/{generators/jasmine/templates/jasmine-example/spec → lib/generators/jasmine/examples/templates/spec/javascripts/helpers/jasmine_examples}/SpecHelper.js +0 -0
  10. data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +1 -1
  11. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +15 -2
  12. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine_helper.rb +2 -2
  13. data/lib/jasmine.rb +5 -7
  14. data/lib/jasmine/asset_bundle.rb +9 -10
  15. data/lib/jasmine/command_line_install.txt +13 -0
  16. data/lib/jasmine/command_line_tool.rb +100 -58
  17. data/lib/jasmine/config.rb +25 -13
  18. data/lib/jasmine/configuration.rb +21 -16
  19. data/lib/jasmine/dependencies.rb +1 -1
  20. data/lib/jasmine/formatters/console.rb +21 -13
  21. data/lib/jasmine/formatters/exit_code.rb +21 -0
  22. data/lib/jasmine/formatters/multi.rb +25 -0
  23. data/lib/jasmine/result.rb +46 -0
  24. data/lib/jasmine/run.html.erb +3 -1
  25. data/lib/jasmine/runners/phantom_jasmine_run.js +54 -0
  26. data/lib/jasmine/runners/phantom_js.rb +29 -0
  27. data/lib/jasmine/tasks/jasmine.rake +42 -21
  28. data/lib/jasmine/version.rb +1 -1
  29. data/spec/configuration_spec.rb +34 -72
  30. data/spec/fixture/coffee_spec.coffee +3 -0
  31. data/spec/fixture/failing_runner.rb +9 -0
  32. data/spec/fixture/failing_test.js +5 -0
  33. data/spec/fixture/large_test_suite_spec.js +20 -0
  34. data/spec/jasmine_command_line_tool_spec.rb +94 -52
  35. data/spec/jasmine_pojs_spec.rb +37 -21
  36. data/spec/jasmine_rails_spec.rb +89 -49
  37. data/spec/lib/jasmine/formatters/console_spec.rb +50 -35
  38. data/spec/lib/jasmine/formatters/multi_spec.rb +17 -0
  39. data/spec/performance/phantom_js_runner_performance_spec.rb +23 -0
  40. data/spec/result_spec.rb +34 -0
  41. data/spec/spec_helper.rb +40 -16
  42. metadata +34 -84
  43. data/generators/jasmine/jasmine_generator.rb +0 -25
  44. data/generators/jasmine/templates/INSTALL +0 -9
  45. data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +0 -58
  46. data/generators/jasmine/templates/jasmine-example/src/Player.js +0 -22
  47. data/generators/jasmine/templates/jasmine-example/src/Song.js +0 -7
  48. data/generators/jasmine/templates/lib/tasks/jasmine.rake +0 -8
  49. data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +0 -81
  50. data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +0 -88
  51. data/generators/jasmine/templates/spec/javascripts/support/jasmine_helper.rb +0 -12
  52. data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +0 -15
  53. data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
  54. data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
  55. data/lib/jasmine/firebug/firebug-license.txt +0 -30
  56. data/lib/jasmine/firebug/firebug.rb +0 -30
  57. data/lib/jasmine/formatters/base.rb +0 -9
  58. data/lib/jasmine/formatters/junit_xml.rb +0 -47
  59. data/lib/jasmine/reporters/api_reporter.rb +0 -38
  60. data/lib/jasmine/results.rb +0 -38
  61. data/lib/jasmine/results_processor.rb +0 -38
  62. data/lib/jasmine/run_specs.rb +0 -33
  63. data/lib/jasmine/runners/http.rb +0 -33
  64. data/lib/jasmine/selenium_driver.rb +0 -45
  65. data/spec/asset_expander_spec.rb +0 -13
  66. data/spec/asset_pipeline_mapper_spec.rb +0 -19
  67. data/spec/jasmine_command_line_tool_rakeless_spec.rb +0 -20
  68. data/spec/lib/jasmine/formatters/base_spec.rb +0 -9
  69. data/spec/lib/jasmine/formatters/junit_xml_spec.rb +0 -55
  70. data/spec/lib/jasmine/reporters/api_reporter_spec.rb +0 -53
  71. data/spec/lib/jasmine/runners/http_spec.rb +0 -21
  72. data/spec/results_processor_spec.rb +0 -3
  73. data/spec/results_spec.rb +0 -69
  74. data/spec/support/fake_selenium_driver.rb +0 -35
@@ -1,25 +0,0 @@
1
- class JasmineGenerator < Rails::Generator::Base
2
- def manifest
3
- m = ::Rails::Generator::Manifest.new
4
-
5
- m.directory "public/javascripts"
6
- m.file "jasmine-example/src/Player.js", "public/javascripts/Player.js"
7
- m.file "jasmine-example/src/Song.js", "public/javascripts/Song.js"
8
-
9
- m.directory "spec/javascripts"
10
- m.file "jasmine-example/spec/PlayerSpec.js", "spec/javascripts/PlayerSpec.js"
11
-
12
- m.directory "spec/javascripts/helpers"
13
- m.file "jasmine-example/spec/SpecHelper.js", "spec/javascripts/helpers/SpecHelper.js"
14
-
15
- m.directory "spec/javascripts/support"
16
- m.file "spec/javascripts/support/jasmine-rails.yml", "spec/javascripts/support/jasmine.yml"
17
- m.file "spec/javascripts/support/jasmine_helper.rb", "spec/javascripts/support/jasmine_helper.rb"
18
- m.readme "INSTALL"
19
-
20
- m.directory "lib/tasks"
21
- m.file "lib/tasks/jasmine.rake", "lib/tasks/jasmine.rake"
22
- m
23
- end
24
-
25
- end
@@ -1,9 +0,0 @@
1
- Jasmine has been installed with example specs.
2
-
3
- To run the server:
4
-
5
- rake jasmine
6
-
7
- To run the automated CI task with Selenium:
8
-
9
- rake jasmine:ci
@@ -1,58 +0,0 @@
1
- describe("Player", function() {
2
- var player;
3
- var song;
4
-
5
- beforeEach(function() {
6
- player = new Player();
7
- song = new Song();
8
- });
9
-
10
- it("should be able to play a Song", function() {
11
- player.play(song);
12
- expect(player.currentlyPlayingSong).toEqual(song);
13
-
14
- //demonstrates use of custom matcher
15
- expect(player).toBePlaying(song);
16
- });
17
-
18
- describe("when song has been paused", function() {
19
- beforeEach(function() {
20
- player.play(song);
21
- player.pause();
22
- });
23
-
24
- it("should indicate that the song is currently paused", function() {
25
- expect(player.isPlaying).toBeFalsy();
26
-
27
- // demonstrates use of 'not' with a custom matcher
28
- expect(player).not.toBePlaying(song);
29
- });
30
-
31
- it("should be possible to resume", function() {
32
- player.resume();
33
- expect(player.isPlaying).toBeTruthy();
34
- expect(player.currentlyPlayingSong).toEqual(song);
35
- });
36
- });
37
-
38
- // demonstrates use of spies to intercept and test method calls
39
- it("tells the current song if the user has made it a favorite", function() {
40
- spyOn(song, 'persistFavoriteStatus');
41
-
42
- player.play(song);
43
- player.makeFavorite();
44
-
45
- expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
46
- });
47
-
48
- //demonstrates use of expected exceptions
49
- describe("#resume", function() {
50
- it("should throw an exception if song is already playing", function() {
51
- player.play(song);
52
-
53
- expect(function() {
54
- player.resume();
55
- }).toThrowError("song is already playing");
56
- });
57
- });
58
- });
@@ -1,22 +0,0 @@
1
- function Player() {
2
- }
3
- Player.prototype.play = function(song) {
4
- this.currentlyPlayingSong = song;
5
- this.isPlaying = true;
6
- };
7
-
8
- Player.prototype.pause = function() {
9
- this.isPlaying = false;
10
- };
11
-
12
- Player.prototype.resume = function() {
13
- if (this.isPlaying) {
14
- throw new Error("song is already playing");
15
- }
16
-
17
- this.isPlaying = true;
18
- };
19
-
20
- Player.prototype.makeFavorite = function() {
21
- this.currentlyPlayingSong.persistFavoriteStatus(true);
22
- };
@@ -1,7 +0,0 @@
1
- function Song() {
2
- }
3
-
4
- Song.prototype.persistFavoriteStatus = function(value) {
5
- // something complicated
6
- throw new Error("not yet implemented");
7
- };
@@ -1,8 +0,0 @@
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
@@ -1,81 +0,0 @@
1
- # src_files
2
- #
3
- # Return an array of filepaths relative to src_dir to include before jasmine specs.
4
- # Default: []
5
- #
6
- # EXAMPLE:
7
- #
8
- # src_files:
9
- # - lib/source1.js
10
- # - lib/source2.js
11
- # - dist/**/*.js
12
- #
13
- src_files:
14
- - public/javascripts/prototype.js
15
- - public/javascripts/effects.js
16
- - public/javascripts/controls.js
17
- - public/javascripts/dragdrop.js
18
- - public/javascripts/application.js
19
- - public/javascripts/**/*.js
20
-
21
- # stylesheets
22
- #
23
- # Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
24
- # Default: []
25
- #
26
- # EXAMPLE:
27
- #
28
- # stylesheets:
29
- # - css/style.css
30
- # - stylesheets/*.css
31
- #
32
- stylesheets:
33
- - stylesheets/**/*.css
34
-
35
- # helpers
36
- #
37
- # Return an array of filepaths relative to spec_dir to include before jasmine specs.
38
- # Default: ["helpers/**/*.js"]
39
- #
40
- # EXAMPLE:
41
- #
42
- # helpers:
43
- # - helpers/**/*.js
44
- #
45
- helpers:
46
- - 'helpers/**/*.js'
47
-
48
- # spec_files
49
- #
50
- # Return an array of filepaths relative to spec_dir to include.
51
- # Default: ["**/*[sS]pec.js"]
52
- #
53
- # EXAMPLE:
54
- #
55
- # spec_files:
56
- # - '**/*[sS]pec.js'
57
- #
58
- spec_files:
59
- - '**/*[sS]pec.js'
60
-
61
- # src_dir
62
- #
63
- # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
64
- # Default: project root
65
- #
66
- # EXAMPLE:
67
- #
68
- # src_dir: public
69
- #
70
- src_dir:
71
-
72
- # spec_dir
73
- #
74
- # Spec directory path. Your spec_files must be returned relative to this path.
75
- # Default: spec/javascripts
76
- #
77
- # EXAMPLE:
78
- #
79
- # spec_dir: spec/javascripts
80
- #
81
- spec_dir: spec/javascripts
@@ -1,88 +0,0 @@
1
- # src_files
2
- #
3
- # Return an array of filepaths relative to src_dir to include before jasmine specs.
4
- # Default: []
5
- #
6
- # EXAMPLE:
7
- #
8
- # src_files:
9
- # - lib/source1.js
10
- # - lib/source2.js
11
- # - dist/**/*.js
12
- #
13
- src_files:
14
- - public/javascripts/**/*.js
15
-
16
- # stylesheets
17
- #
18
- # Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
19
- # Default: []
20
- #
21
- # EXAMPLE:
22
- #
23
- # stylesheets:
24
- # - css/style.css
25
- # - stylesheets/*.css
26
- #
27
- stylesheets:
28
-
29
- # helpers
30
- #
31
- # Return an array of filepaths relative to spec_dir to include before jasmine specs.
32
- # Default: ["helpers/**/*.js"]
33
- #
34
- # EXAMPLE:
35
- #
36
- # helpers:
37
- # - helpers/**/*.js
38
- #
39
- helpers:
40
- - 'helpers/**/*.js'
41
- # spec_files
42
- #
43
- # Return an array of filepaths relative to spec_dir to include.
44
- # Default: ["**/*[sS]pec.js"]
45
- #
46
- # EXAMPLE:
47
- #
48
- # spec_files:
49
- # - **/*[sS]pec.js
50
- #
51
- spec_files:
52
- - '**/*[sS]pec.js'
53
-
54
- # src_dir
55
- #
56
- # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
57
- # Default: project root
58
- #
59
- # EXAMPLE:
60
- #
61
- # src_dir: public
62
- #
63
- src_dir:
64
-
65
- # spec_dir
66
- #
67
- # Spec directory path. Your spec_files must be returned relative to this path.
68
- # Default: spec/javascripts
69
- #
70
- # EXAMPLE:
71
- #
72
- # spec_dir: spec/javascripts
73
- #
74
- spec_dir:
75
-
76
- # spec_helper
77
- #
78
- # Ruby file that Jasmine server will require before starting.
79
- # Returned relative to your root path
80
- # Default spec/javascripts/support/jasmine_helper.rb
81
- #
82
- # EXAMPLE:
83
- #
84
- # spec_helper: spec/javascripts/support/jasmine_helper.rb
85
- #
86
- spec_helper: spec/javascripts/support/jasmine_helper.rb
87
-
88
-
@@ -1,12 +0,0 @@
1
- #Use this file to set/override Jasmine configuration options
2
- #You can remove it if you don't need it.
3
- #This file is loaded *after* jasmine.yml is interpreted.
4
- #
5
- #Example: using a different boot file.
6
- #Jasmine.configure do |config|
7
- # config.boot_dir = '/absolute/path/to/boot_dir'
8
- # config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
9
- # config.browser = :firefox
10
- #end
11
- #
12
-
@@ -1,15 +0,0 @@
1
- beforeEach(function () {
2
- jasmine.Expectation.addMatchers({
3
- toBePlaying: function () {
4
- return {
5
- compare: function (actual, expected) {
6
- var player = actual;
7
-
8
- return {
9
- pass: player.currentlyPlayingSong === expected && player.isPlaying
10
- }
11
- }
12
- };
13
- }
14
- });
15
- });
Binary file
Binary file
@@ -1,30 +0,0 @@
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.
@@ -1,30 +0,0 @@
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
@@ -1,9 +0,0 @@
1
- module Jasmine
2
- module Formatters
3
- class BaseFormatter < Struct.new(:results)
4
- def format
5
- raise NotImplementedError.new('You must override the summary method on any custom formatters.')
6
- end
7
- end
8
- end
9
- end
@@ -1,47 +0,0 @@
1
- require 'nokogiri'
2
-
3
- module Jasmine
4
- module Formatters
5
- class JUnitXml < BaseFormatter
6
- def format
7
- f = open(File.join(Jasmine.config.junit_xml_location, 'junit_results.xml'), 'w')
8
- f.puts summary
9
- f.close()
10
- end
11
-
12
- def summary
13
- doc = Nokogiri::XML '<testsuites></testsuites>', nil, 'UTF-8'
14
-
15
- testsuites = doc.at_css('testsuites')
16
-
17
- results.results.each do |result|
18
- suite_name = result.full_name.slice(0, result.full_name.size - result.description.size - 1)
19
-
20
- testsuite = Nokogiri::XML::Node.new 'testsuite', doc
21
- testsuite['tests'] = 1
22
- testsuite['failures'] = result.status == 'failed' ? 1 : 0
23
- testsuite['errors'] = 0
24
- testsuite['name'] = suite_name
25
- testsuite.parent = testsuites
26
-
27
- testcase = Nokogiri::XML::Node.new 'testcase', doc
28
- testcase['name'] = result.description
29
-
30
- if result.status == 'failed'
31
- result.failed_expectations.each do |failed_exp|
32
- failure = Nokogiri::XML::Node.new 'failure', doc
33
- failure['message'] = failed_exp.message
34
- failure['type'] = 'Failure'
35
- failure.content = failed_exp.stack
36
- failure.parent = testcase
37
- end
38
- end
39
-
40
- testcase.parent = testsuite
41
- end
42
-
43
- doc.to_xml(indent: 2)
44
- end
45
- end
46
- end
47
- end