jasmine-multi_json 1.3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. data/.gitignore +13 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +58 -0
  4. data/Gemfile +8 -0
  5. data/HOW_TO_TEST.markdown +9 -0
  6. data/MIT.LICENSE +20 -0
  7. data/README.markdown +77 -0
  8. data/RELEASE.markdown +22 -0
  9. data/RELEASE_NOTES.markdown +6 -0
  10. data/Rakefile +62 -0
  11. data/generators/jasmine/jasmine_generator.rb +24 -0
  12. data/generators/jasmine/templates/INSTALL +9 -0
  13. data/generators/jasmine/templates/jasmine-example/SpecRunner.html +54 -0
  14. data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +58 -0
  15. data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +9 -0
  16. data/generators/jasmine/templates/jasmine-example/src/Player.js +22 -0
  17. data/generators/jasmine/templates/jasmine-example/src/Song.js +7 -0
  18. data/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -0
  19. data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +81 -0
  20. data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +74 -0
  21. data/jasmine.gemspec +74 -0
  22. data/lib/generators/jasmine/examples/USAGE +11 -0
  23. data/lib/generators/jasmine/examples/examples_generator.rb +19 -0
  24. data/lib/generators/jasmine/examples/templates/app/assets/javascripts/jasmine_examples/Player.js +22 -0
  25. data/lib/generators/jasmine/examples/templates/app/assets/javascripts/jasmine_examples/Song.js +7 -0
  26. data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +9 -0
  27. data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +58 -0
  28. data/lib/generators/jasmine/install/USAGE +11 -0
  29. data/lib/generators/jasmine/install/install_generator.rb +18 -0
  30. data/lib/generators/jasmine/install/templates/spec/javascripts/helpers/.gitkeep +0 -0
  31. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +76 -0
  32. data/lib/jasmine.rb +31 -0
  33. data/lib/jasmine/application.rb +21 -0
  34. data/lib/jasmine/asset_expander.rb +19 -0
  35. data/lib/jasmine/asset_pipeline_mapper.rb +16 -0
  36. data/lib/jasmine/asset_pipeline_utility.rb +19 -0
  37. data/lib/jasmine/base.rb +54 -0
  38. data/lib/jasmine/command_line_tool.rb +70 -0
  39. data/lib/jasmine/config.rb +85 -0
  40. data/lib/jasmine/configuration.rb +83 -0
  41. data/lib/jasmine/core_configuration.rb +28 -0
  42. data/lib/jasmine/dependencies.rb +59 -0
  43. data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
  44. data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
  45. data/lib/jasmine/firebug/firebug-license.txt +30 -0
  46. data/lib/jasmine/firebug/firebug.rb +30 -0
  47. data/lib/jasmine/javascripts/boot.js +28 -0
  48. data/lib/jasmine/page.rb +11 -0
  49. data/lib/jasmine/path_expander.rb +18 -0
  50. data/lib/jasmine/path_mapper.rb +29 -0
  51. data/lib/jasmine/railtie.rb +21 -0
  52. data/lib/jasmine/results.rb +19 -0
  53. data/lib/jasmine/results_processor.rb +38 -0
  54. data/lib/jasmine/rspec_formatter.rb +92 -0
  55. data/lib/jasmine/run.html.erb +18 -0
  56. data/lib/jasmine/run_specs.rb +36 -0
  57. data/lib/jasmine/runners/http.rb +71 -0
  58. data/lib/jasmine/selenium_driver.rb +41 -0
  59. data/lib/jasmine/server.rb +20 -0
  60. data/lib/jasmine/tasks/jasmine.rake +55 -0
  61. data/lib/jasmine/tasks/jasmine_rails3.rake +1 -0
  62. data/lib/jasmine/version.rb +3 -0
  63. data/lib/jasmine/yaml_config_parser.rb +54 -0
  64. data/lib/rack/jasmine/cache_control.rb +20 -0
  65. data/lib/rack/jasmine/focused_suite.rb +17 -0
  66. data/lib/rack/jasmine/runner.rb +27 -0
  67. data/spec/application_integration_spec.rb +15 -0
  68. data/spec/application_spec.rb +44 -0
  69. data/spec/asset_expander_spec.rb +42 -0
  70. data/spec/asset_pipeline_mapper_spec.rb +19 -0
  71. data/spec/base_spec.rb +14 -0
  72. data/spec/configuration_spec.rb +163 -0
  73. data/spec/dependencies_spec.rb +315 -0
  74. data/spec/fixture/Rakefile +4 -0
  75. data/spec/jasmine_command_line_tool_rakeless_spec.rb +20 -0
  76. data/spec/jasmine_command_line_tool_spec.rb +29 -0
  77. data/spec/jasmine_pojs_spec.rb +47 -0
  78. data/spec/jasmine_rails2_spec.rb +89 -0
  79. data/spec/jasmine_rails3_spec.rb +69 -0
  80. data/spec/jasmine_self_test_spec.rb +29 -0
  81. data/spec/page_spec.rb +23 -0
  82. data/spec/path_expander_spec.rb +96 -0
  83. data/spec/path_mapper_spec.rb +33 -0
  84. data/spec/rack/jasmine/runner_spec.rb +25 -0
  85. data/spec/results_processor_spec.rb +3 -0
  86. data/spec/results_spec.rb +27 -0
  87. data/spec/rspec_formatter_spec.rb +88 -0
  88. data/spec/server_spec.rb +48 -0
  89. data/spec/spec_helper.rb +55 -0
  90. data/spec/yaml_config_parser_spec.rb +182 -0
  91. metadata +310 -0
@@ -0,0 +1,22 @@
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
+ };
@@ -0,0 +1,7 @@
1
+ function Song() {
2
+ }
3
+
4
+ Song.prototype.persistFavoriteStatus = function(value) {
5
+ // something complicated
6
+ throw new Error("not yet implemented");
7
+ };
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,81 @@
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
@@ -0,0 +1,74 @@
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:
@@ -0,0 +1,74 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jasmine/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{jasmine-multi_json}
7
+ s.version = Jasmine::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+
10
+ s.authors = ["Rajan Agaskar", "Christian Williams", "Davis Frank"]
11
+ s.summary = %q{JavaScript BDD framework}
12
+ s.description = %q{Test your JavaScript without any framework dependencies, in any environment, and with a nice descriptive syntax.}
13
+ s.email = %q{jasmine-js@googlegroups.com}
14
+ s.homepage = "http://pivotal.github.com/jasmine/"
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files`.split("\n") | Dir.glob('jasmine/**/*')
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ s.rdoc_options = ["--charset=UTF-8"]
22
+
23
+ if ENV['RAILS_VERSION'] == 'pojs-rspec1'
24
+ if ENV["RUBY_VERSION"] =~ /1\.8\.6/
25
+ #1.3.2 buffer overflows
26
+ s.add_development_dependency 'rspec', '= 1.3.1'
27
+ s.add_development_dependency 'rack', "1.1"
28
+ else
29
+ s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
30
+ end
31
+ s.add_development_dependency 'rake-tasks'
32
+ elsif ENV['RAILS_VERSION'] == 'pojs-rspec2'
33
+ if ENV["RUBY_VERSION"] =~ /1\.8\.6/
34
+ #2.7.0 uses reduce vs inject, non 1.8.6 compatible
35
+ s.add_development_dependency 'rspec', '2.6.0'
36
+ else
37
+ s.add_development_dependency 'rspec', '>= 2.5.0'
38
+ end
39
+ s.add_development_dependency 'rake-tasks'
40
+ s.add_development_dependency 'rack', "1.1" if ENV["RUBY_VERSION"] =~ /1\.8\.6/
41
+ elsif ENV['RAILS_VERSION'] == 'rails2'
42
+ if ENV["RUBY_VERSION"] =~ /1\.8\.6/
43
+ #1.3.2 buffer overflows
44
+ s.add_development_dependency 'rspec', '= 1.3.1'
45
+ else
46
+ s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
47
+ end
48
+ # for development & test of Rails 2 Generators
49
+ s.add_development_dependency 'rails', '2.3.11', "< 3"
50
+ elsif ENV['RAILS_VERSION'] == 'rails2_3_5'
51
+ if ENV["RUBY_VERSION"] =~ /1\.8\.6/
52
+ #1.3.2 buffer overflows
53
+ s.add_development_dependency 'rspec', '= 1.3.1'
54
+ else
55
+ s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
56
+ end
57
+ # for development & test of Rails 2 Generators
58
+ s.add_development_dependency 'rails', '= 2.3.5'
59
+ else
60
+ # for development & test of Rails 3 Generators
61
+ s.add_development_dependency 'rspec', '>= 2.5.0'
62
+ s.add_development_dependency 'rails', '>= 3.0.0'
63
+ s.add_development_dependency 'rack', '>= 1.2.1'
64
+ end
65
+
66
+ s.add_development_dependency 'rack-test'
67
+ s.add_development_dependency 'multi_json'
68
+ s.add_development_dependency 'nokogiri'
69
+
70
+ s.add_dependency 'jasmine-core', "~> 1.3.1"
71
+ s.add_dependency 'rack', '~> 1.0'
72
+ s.add_dependency 'rspec', '>= 1.3.1'
73
+ s.add_dependency 'selenium-webdriver', '>= 0.1.3'
74
+ end
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Install jasmine examples
3
+
4
+ Example:
5
+ rails generate jasmine:examples
6
+
7
+ This will create:
8
+ public/javascripts/jasmine_examples/PlayerSpec.js
9
+ public/javascripts/jasmine_examples/SpecHelper.js
10
+ spec/javascripts/jasmine_examples/PlayerSpec.js
11
+ spec/javascripts/jasmine_examples/SpecHelper.js
@@ -0,0 +1,19 @@
1
+ module Jasmine
2
+ module Generators
3
+ class ExamplesGenerator < Rails::Generators::Base
4
+
5
+ def self.source_root
6
+ @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
7
+ end
8
+
9
+ def copy_example_files
10
+ directory 'app'
11
+ directory 'spec'
12
+ end
13
+
14
+ def app_name
15
+ Rails.application.class.name
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
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
+ };
@@ -0,0 +1,7 @@
1
+ function Song() {
2
+ }
3
+
4
+ Song.prototype.persistFavoriteStatus = function(value) {
5
+ // something complicated
6
+ throw new Error("not yet implemented");
7
+ };
@@ -0,0 +1,9 @@
1
+ beforeEach(function() {
2
+ this.addMatchers({
3
+ toBePlaying: function(expectedSong) {
4
+ var player = this.actual;
5
+ return player.currentlyPlayingSong === expectedSong
6
+ && player.isPlaying;
7
+ }
8
+ })
9
+ });
@@ -0,0 +1,58 @@
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
+ }).toThrow("song is already playing");
56
+ });
57
+ });
58
+ });
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Install jasmine
3
+
4
+ Example:
5
+ rails generate jasmine:install
6
+
7
+ This will create:
8
+ spec/javascripts/support/jasmine.yml
9
+ spec/javascripts/support/jasmine_config.rb
10
+ spec/javascripts/support/jasmine_runner.rb
11
+ spec/javascripts/helpers/.gitkeep
@@ -0,0 +1,18 @@
1
+ module Jasmine
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ def self.source_root
6
+ @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
7
+ end
8
+
9
+ def copy_spec_files
10
+ directory 'spec'
11
+ end
12
+
13
+ def app_name
14
+ Rails.application.class.name
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,76 @@
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
+ - assets/application.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
+ - stylesheets/**/*.css
29
+
30
+ # helpers
31
+ #
32
+ # Return an array of filepaths relative to spec_dir to include before jasmine specs.
33
+ # Default: ["helpers/**/*.js"]
34
+ #
35
+ # EXAMPLE:
36
+ #
37
+ # helpers:
38
+ # - helpers/**/*.js
39
+ #
40
+ helpers:
41
+ - helpers/**/*.js
42
+
43
+ # spec_files
44
+ #
45
+ # Return an array of filepaths relative to spec_dir to include.
46
+ # Default: ["**/*[sS]pec.js"]
47
+ #
48
+ # EXAMPLE:
49
+ #
50
+ # spec_files:
51
+ # - **/*[sS]pec.js
52
+ #
53
+ spec_files:
54
+ - '**/*[sS]pec.js'
55
+
56
+ # src_dir
57
+ #
58
+ # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
59
+ # Default: project root
60
+ #
61
+ # EXAMPLE:
62
+ #
63
+ # src_dir: public
64
+ #
65
+ src_dir:
66
+
67
+ # spec_dir
68
+ #
69
+ # Spec directory path. Your spec_files must be returned relative to this path.
70
+ # Default: spec/javascripts
71
+ #
72
+ # EXAMPLE:
73
+ #
74
+ # spec_dir: spec/javascripts
75
+ #
76
+ spec_dir: spec/javascripts