jasmine-headless-webkit-firstbanco 0.9.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG.md +89 -0
  5. data/Gemfile +30 -0
  6. data/Guardfile +41 -0
  7. data/README.md +44 -0
  8. data/Rakefile +65 -0
  9. data/bin/jasmine-headless-webkit +11 -0
  10. data/config/cucumber.yml +2 -0
  11. data/ext/jasmine-webkit-specrunner/Info.plist +22 -0
  12. data/ext/jasmine-webkit-specrunner/Makefile.dummy +5 -0
  13. data/ext/jasmine-webkit-specrunner/Page.cpp +15 -0
  14. data/ext/jasmine-webkit-specrunner/Page.h +20 -0
  15. data/ext/jasmine-webkit-specrunner/Runner.cpp +208 -0
  16. data/ext/jasmine-webkit-specrunner/Runner.h +73 -0
  17. data/ext/jasmine-webkit-specrunner/common.pri +8 -0
  18. data/ext/jasmine-webkit-specrunner/extconf.rb +10 -0
  19. data/ext/jasmine-webkit-specrunner/specrunner.cpp +79 -0
  20. data/ext/jasmine-webkit-specrunner/specrunner.pro +5 -0
  21. data/features/bin/failure.feature +7 -0
  22. data/features/bin/files.feature +7 -0
  23. data/features/bin/filtered_run/both_runs.feature +18 -0
  24. data/features/bin/filtered_run/no_full_run.feature +14 -0
  25. data/features/bin/help.feature +7 -0
  26. data/features/bin/quiet_messages.feature +8 -0
  27. data/features/bin/runner_out.feature +8 -0
  28. data/features/bin/spec_files_with_same_basename.feature +7 -0
  29. data/features/bin/success.feature +20 -0
  30. data/features/bin/success_with_js_error.feature +5 -0
  31. data/features/bin/tries_to_leave_page.feature +7 -0
  32. data/features/bin/try_to_click_a_button.feature +7 -0
  33. data/features/bin/two_files_from_src_files.feature +11 -0
  34. data/features/bin/with_coffeescript_error.feature +7 -0
  35. data/features/bin/with_console_log.feature +7 -0
  36. data/features/bin/with_server.feature +7 -0
  37. data/features/bin/with_window_prompt.feature +7 -0
  38. data/features/reporters.feature +24 -0
  39. data/features/runner.feature +34 -0
  40. data/features/steps/given/i_have_test_suite.rb +2 -0
  41. data/features/steps/given/no_existing_file.rb +4 -0
  42. data/features/steps/given/options/i_have_defaults.rb +4 -0
  43. data/features/steps/given/options/i_have_reporters.rb +10 -0
  44. data/features/steps/given/options/i_have_runner_options.rb +3 -0
  45. data/features/steps/then/bin/exit_status_should_be.rb +3 -0
  46. data/features/steps/then/bin/file_should_contain_runner.rb +4 -0
  47. data/features/steps/then/bin/following_files_loaded_in_order.rb +10 -0
  48. data/features/steps/then/bin/i_should_get_help_output.rb +4 -0
  49. data/features/steps/then/bin/output_should_include.rb +3 -0
  50. data/features/steps/then/bin/output_should_not_include.rb +4 -0
  51. data/features/steps/then/reporting/report_does_not_exist.rb +4 -0
  52. data/features/steps/then/reporting/report_should_exist.rb +3 -0
  53. data/features/steps/then/reporting/report_should_have.rb +7 -0
  54. data/features/steps/then/reporting/report_should_have_seed.rb +4 -0
  55. data/features/steps/then/runner/it_should_have_exit_status.rb +3 -0
  56. data/features/steps/then/runner/it_should_include_report_file.rb +4 -0
  57. data/features/steps/then/runner/it_should_not_include_report_file.rb +3 -0
  58. data/features/steps/then/templates/it_should_use_reporter.rb +6 -0
  59. data/features/steps/when/i_delete_file.rb +3 -0
  60. data/features/steps/when/i_get_runner.rb +4 -0
  61. data/features/steps/when/i_get_template_writer.rb +4 -0
  62. data/features/steps/when/i_run_executable.rb +4 -0
  63. data/features/steps/when/i_run_runner.rb +4 -0
  64. data/features/support/env.rb +7 -0
  65. data/jasmine-headless-webkit-firstbanco.gemspec +30 -0
  66. data/lib/autotest/discover.rb +1 -0
  67. data/lib/autotest/jasmine.rb +7 -0
  68. data/lib/autotest/jasmine_mixin.rb +111 -0
  69. data/lib/autotest/jasmine_rspec2.rb +7 -0
  70. data/lib/jasmine-headless-webkit.rb +3 -0
  71. data/lib/jasmine/headless.rb +61 -0
  72. data/lib/jasmine/headless/cacheable_action.rb +85 -0
  73. data/lib/jasmine/headless/coffee_script_cache.rb +20 -0
  74. data/lib/jasmine/headless/coffee_template.rb +36 -0
  75. data/lib/jasmine/headless/command_line.rb +31 -0
  76. data/lib/jasmine/headless/css_template.rb +19 -0
  77. data/lib/jasmine/headless/errors.rb +16 -0
  78. data/lib/jasmine/headless/file_checker.rb +25 -0
  79. data/lib/jasmine/headless/files_list.rb +332 -0
  80. data/lib/jasmine/headless/js_template.rb +23 -0
  81. data/lib/jasmine/headless/jst_template.rb +15 -0
  82. data/lib/jasmine/headless/nil_template.rb +14 -0
  83. data/lib/jasmine/headless/options.rb +206 -0
  84. data/lib/jasmine/headless/railtie.rb +12 -0
  85. data/lib/jasmine/headless/report.rb +81 -0
  86. data/lib/jasmine/headless/report_message.rb +12 -0
  87. data/lib/jasmine/headless/report_message/console.rb +18 -0
  88. data/lib/jasmine/headless/report_message/error.rb +20 -0
  89. data/lib/jasmine/headless/report_message/fail.rb +5 -0
  90. data/lib/jasmine/headless/report_message/pass.rb +5 -0
  91. data/lib/jasmine/headless/report_message/seed.rb +14 -0
  92. data/lib/jasmine/headless/report_message/spec.rb +28 -0
  93. data/lib/jasmine/headless/report_message/total.rb +31 -0
  94. data/lib/jasmine/headless/runner.rb +264 -0
  95. data/lib/jasmine/headless/spec_file_analyzer.rb +44 -0
  96. data/lib/jasmine/headless/task.rb +39 -0
  97. data/lib/jasmine/headless/template_writer.rb +65 -0
  98. data/lib/jasmine/headless/unique_asset_list.rb +16 -0
  99. data/lib/jasmine/headless/version.rb +5 -0
  100. data/lib/qt/qmake.rb +155 -0
  101. data/script/gemfile +11 -0
  102. data/script/hooks/post-commit +4 -0
  103. data/script/hooks/pre-commit +15 -0
  104. data/script/initialize-environment +35 -0
  105. data/script/install-git-hooks +6 -0
  106. data/skel/template.html.erb +77 -0
  107. data/spec/files/UTF-8-test.txt +0 -0
  108. data/spec/integration/randomization_spec.rb +13 -0
  109. data/spec/integration/specify_runner_file_spec.rb +22 -0
  110. data/spec/integration/sprockets_spec.rb +23 -0
  111. data/spec/jasmine/click_button/click_button.js +5 -0
  112. data/spec/jasmine/click_button/click_button.yml +12 -0
  113. data/spec/jasmine/click_button/click_button_spec.js +11 -0
  114. data/spec/jasmine/coffeescript_error/coffeescript_error.yml +10 -0
  115. data/spec/jasmine/coffeescript_error/spec.coffee +2 -0
  116. data/spec/jasmine/coffeescript_error/src.coffee +2 -0
  117. data/spec/jasmine/console_log/console_log.js +1 -0
  118. data/spec/jasmine/console_log/console_log.yml +10 -0
  119. data/spec/jasmine/console_log/console_log_spec.js +7 -0
  120. data/spec/jasmine/failure/failure.js +1 -0
  121. data/spec/jasmine/failure/failure.yml +9 -0
  122. data/spec/jasmine/failure/failure_spec.js +6 -0
  123. data/spec/jasmine/filtered_failure/failure_spec.js +6 -0
  124. data/spec/jasmine/filtered_failure/filtered_failure.yml +10 -0
  125. data/spec/jasmine/filtered_failure/src.js +0 -0
  126. data/spec/jasmine/filtered_failure/success_spec.js +6 -0
  127. data/spec/jasmine/filtered_success/filtered_success.yml +10 -0
  128. data/spec/jasmine/filtered_success/src.js +0 -0
  129. data/spec/jasmine/filtered_success/success_one_spec.js +6 -0
  130. data/spec/jasmine/filtered_success/success_other_file.js +7 -0
  131. data/spec/jasmine/filtered_success/success_two_spec.js +6 -0
  132. data/spec/jasmine/filtered_success_with_console/filtered_success.yml +10 -0
  133. data/spec/jasmine/filtered_success_with_console/src.js +0 -0
  134. data/spec/jasmine/filtered_success_with_console/success_one_spec.js +7 -0
  135. data/spec/jasmine/filtered_success_with_console/success_two_spec.js +6 -0
  136. data/spec/jasmine/leave_page/leave_page.js +4 -0
  137. data/spec/jasmine/leave_page/leave_page.yml +9 -0
  138. data/spec/jasmine/leave_page/leave_page_spec.js +11 -0
  139. data/spec/jasmine/noisy/file.js.erb +0 -0
  140. data/spec/jasmine/noisy/noisy.yml +8 -0
  141. data/spec/jasmine/noisy/other_file.js +2 -0
  142. data/spec/jasmine/runner_out_in_jasmine_yml/jasmine.yml +11 -0
  143. data/spec/jasmine/runner_out_in_jasmine_yml/test.js +2 -0
  144. data/spec/jasmine/runner_out_in_jasmine_yml/test_spec.coffee +4 -0
  145. data/spec/jasmine/success/success.js +1 -0
  146. data/spec/jasmine/success/success.yml +9 -0
  147. data/spec/jasmine/success/success_spec.js +6 -0
  148. data/spec/jasmine/success_with_error/success_with_error.js +3 -0
  149. data/spec/jasmine/success_with_error/success_with_error.yml +9 -0
  150. data/spec/jasmine/success_with_error/success_with_error_spec.js +6 -0
  151. data/spec/jasmine/two_files_from_src_files/app/app-file.js +0 -0
  152. data/spec/jasmine/two_files_from_src_files/app/app.js +2 -0
  153. data/spec/jasmine/two_files_from_src_files/jasmine.yml +7 -0
  154. data/spec/jasmine/two_files_from_src_files/vendor/vendor-file.js +0 -0
  155. data/spec/jasmine/two_files_from_src_files/vendor/vendor.js +2 -0
  156. data/spec/jasmine/two_spec_files_same_basename/jasmine.yml +6 -0
  157. data/spec/jasmine/two_spec_files_same_basename/spec.coffee +4 -0
  158. data/spec/jasmine/two_spec_files_same_basename/spec.js +6 -0
  159. data/spec/jasmine/window_prompt/source.js +2 -0
  160. data/spec/jasmine/window_prompt/window_prompt.yml +4 -0
  161. data/spec/jasmine/with_sprockets_includes/assets/application.js.erb +2 -0
  162. data/spec/jasmine/with_sprockets_includes/assets/things/code.js +6 -0
  163. data/spec/jasmine/with_sprockets_includes/assets/things/jquery.string.js +0 -0
  164. data/spec/jasmine/with_sprockets_includes/assets/things/required.js +3 -0
  165. data/spec/jasmine/with_sprockets_includes/assets/things/subcode/more_code.js +2 -0
  166. data/spec/jasmine/with_sprockets_includes/assets/things/templates/that.jst.ejs +1 -0
  167. data/spec/jasmine/with_sprockets_includes/assets/things/templates/this.jst +2 -0
  168. data/spec/jasmine/with_sprockets_includes/spec/spec_helper.js +1 -0
  169. data/spec/jasmine/with_sprockets_includes/spec/things/code_spec.js +9 -0
  170. data/spec/jasmine/with_sprockets_includes/with_sprockets_includes.yml +12 -0
  171. data/spec/javascripts/console.log_spec.coffee +15 -0
  172. data/spec/javascripts/headless_reporter_result_spec.coffee +30 -0
  173. data/spec/javascripts/helpers/spec_helper.coffee +2 -0
  174. data/spec/javascripts/jasmine-extensions_spec.coffee +80 -0
  175. data/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee +35 -0
  176. data/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +3 -0
  177. data/spec/javascripts/jasmine.HeadlessReporter.Tap_spec.coffee +19 -0
  178. data/spec/javascripts/jasmine.HeadlessReporter_spec.coffee +27 -0
  179. data/spec/javascripts/support/jasmine.yml +9 -0
  180. data/spec/lib/jasmine/headless/cacheable_action_spec.rb +122 -0
  181. data/spec/lib/jasmine/headless/coffee_script_cache_spec.rb +21 -0
  182. data/spec/lib/jasmine/headless/coffee_template_spec.rb +55 -0
  183. data/spec/lib/jasmine/headless/css_template_spec.rb +25 -0
  184. data/spec/lib/jasmine/headless/file_checker_spec.rb +41 -0
  185. data/spec/lib/jasmine/headless/files_list_spec.rb +194 -0
  186. data/spec/lib/jasmine/headless/js_template_spec.rb +31 -0
  187. data/spec/lib/jasmine/headless/jst_template_spec.rb +21 -0
  188. data/spec/lib/jasmine/headless/nil_template_spec.rb +31 -0
  189. data/spec/lib/jasmine/headless/options_spec.rb +194 -0
  190. data/spec/lib/jasmine/headless/report_message/seed_spec.rb +18 -0
  191. data/spec/lib/jasmine/headless/report_message/spec_spec.rb +20 -0
  192. data/spec/lib/jasmine/headless/report_spec.rb +95 -0
  193. data/spec/lib/jasmine/headless/runner_spec.rb +247 -0
  194. data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +68 -0
  195. data/spec/lib/jasmine/headless/task_spec.rb +92 -0
  196. data/spec/lib/jasmine/headless/template_writer_spec.rb +92 -0
  197. data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +22 -0
  198. data/spec/lib/jasmine/headless_spec.rb +38 -0
  199. data/spec/lib/qt/qmake_spec.rb +142 -0
  200. data/spec/skel/template.html.erb_spec.rb +8 -0
  201. data/spec/spec_helper.rb +113 -0
  202. data/vendor/assets/coffeescripts/headless_reporter_result.coffee +49 -0
  203. data/vendor/assets/coffeescripts/prolog.coffee +100 -0
  204. data/vendor/assets/javascripts/beautify-html.js +463 -0
  205. data/vendor/assets/javascripts/headless_reporter_result.js +79 -0
  206. data/vendor/assets/javascripts/intense.coffee +28 -0
  207. data/vendor/assets/javascripts/jasmine-extensions.coffee +97 -0
  208. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee +8 -0
  209. data/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee +92 -0
  210. data/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee +24 -0
  211. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee +28 -0
  212. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +64 -0
  213. data/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee +58 -0
  214. data/vendor/assets/javascripts/jsDump.js +209 -0
  215. data/vendor/assets/javascripts/prolog.js +108 -0
  216. metadata +347 -0
@@ -0,0 +1,5 @@
1
+ module Jasmine
2
+ module Headless
3
+ VERSION = "0.9.0.rc.2"
4
+ end
5
+ end
@@ -0,0 +1,155 @@
1
+ require 'rbconfig'
2
+ require 'rubygems'
3
+ require 'rubygems/version'
4
+
5
+ module Qt
6
+ class NotInstalledError < StandardError; end
7
+ class Qmake
8
+ class << self
9
+ QMAKES = %w{qmake-qt4 qmake}
10
+
11
+ def installed?
12
+ path != nil
13
+ end
14
+
15
+ def make_installed?
16
+ make_path != nil
17
+ end
18
+
19
+ def command(project_file = nil)
20
+ spec = (case platform
21
+ when :linux
22
+ "linux-g++"
23
+ when :freebsd
24
+ "freebsd-g++"
25
+ when :mac_os_x
26
+ "macx-g++"
27
+ end)
28
+
29
+ command = "#{path} #{envs} -spec #{spec}"
30
+ command << " #{project_file}" if project_file
31
+ command
32
+ end
33
+
34
+ def make!(name, project_file = nil)
35
+ @name = name
36
+
37
+ check_make!
38
+ check_qmake!
39
+
40
+ system command(project_file)
41
+
42
+ system %{make}
43
+ end
44
+
45
+ #
46
+ # We need integration tests for these!
47
+ #
48
+ def path
49
+ @path ||= best_qmake
50
+ end
51
+
52
+ def make_path
53
+ get_exe_path('gmake') || get_exe_path('make')
54
+ end
55
+
56
+ def platform
57
+ case RbConfig::CONFIG['host_os']
58
+ when /linux/
59
+ :linux
60
+ when /freebsd/i
61
+ :freebsd
62
+ when /darwin/
63
+ :mac_os_x
64
+ end
65
+ end
66
+
67
+ def qt_version_of(qmake_path)
68
+ Gem::Version.new(%x{#{qmake_path} -v}.lines.to_a[1][%r{Using Qt version ([^ ]+) },1])
69
+ end
70
+
71
+ def best_qmake
72
+ if qmake_path = QMAKES.collect do |path|
73
+ result = nil
74
+ if qmake_path = get_exe_path(path)
75
+ if (qt_version = qt_version_of(qmake_path)) >= Gem::Version.create('4.7')
76
+ result = [ qmake_path, qt_version ]
77
+ end
78
+ end
79
+ result
80
+ end.compact.sort { |a, b| b.last <=> a.last }.first
81
+ qmake_path.first
82
+ else
83
+ nil
84
+ end
85
+ end
86
+
87
+ private
88
+ def envs
89
+ %w{QMAKE_CC QMAKE_CXX}.collect do |env|
90
+ if ENV[env]
91
+ "#{env}=#{ENV[env]}"
92
+ end
93
+ end.compact.join(" ")
94
+ end
95
+
96
+ def get_exe_path(command)
97
+ path = %x{which #{command}}.strip
98
+ path = nil if path == ''
99
+ path
100
+ end
101
+
102
+ def check_make!
103
+ if !make_installed?
104
+ install_method = (
105
+ case platform
106
+ when :linux
107
+ %{sudo apt-get install make or sudo yum install make}
108
+ when :freebsd
109
+ %{install /usr/ports/devel/gmake}
110
+ when :mac_os_x
111
+ %{Install XCode, and/or sudo port install make}
112
+ end
113
+ )
114
+
115
+ $stderr.puts <<-MSG
116
+ make is not installed. You'll need to install it to build #{@name}.
117
+ #{install_method} should do it for you.
118
+ MSG
119
+ raise NotInstalledError
120
+ end
121
+ end
122
+
123
+ def check_qmake!
124
+ if !installed?
125
+ install_method = (
126
+ case platform
127
+ when :linux
128
+ <<-MSG
129
+ sudo apt-get install libqt4-dev qt4-qmake on Debian-based systems, or downloading
130
+ Nokia's prebuilt binary at http://qt.nokia.com/downloads/
131
+ MSG
132
+ when :freebsd
133
+ <<-MSG
134
+ Install /usr/ports/www/qt4-webkit and /usr/ports/devel/qmake4.
135
+ MSG
136
+ MSG
137
+ when :mac_os_x
138
+ <<-MSG
139
+ sudo port install qt4-mac (for the patient) or downloading Nokia's pre-built binary
140
+ at http://qt.nokia.com/downloads/
141
+ MSG
142
+ end
143
+ ).strip
144
+
145
+ $stderr.puts <<-MSG
146
+ qmake is not installed or is not the right version (#{@name} needs Qt 4.7 or above).
147
+ You'll need to install it to build #{@name}.
148
+ #{install_method} should do it for you.
149
+ MSG
150
+ end
151
+ end
152
+ end
153
+ end
154
+ end
155
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'penchant'
5
+
6
+ if Penchant::Gemfile.do_full_env_switch!(ARGV[0])
7
+ puts "Gemfile switched to #{ARGV[0]}"
8
+ else
9
+ exit 0
10
+ end
11
+
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ penchant gemfile remote --switch-back
4
+
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ OLD_GIT_DIR=$GIT_DIR
4
+
5
+ if [ "$(penchant gemfile-env)" != "remote deployment" ]; then
6
+ unset GIT_DIR
7
+ penchant gemfile remote --deployment
8
+ GIT_DIR=$OLD_GIT_DIR
9
+ git add Gemfile*
10
+ fi
11
+
12
+ bundle exec rake
13
+ R=$?
14
+ if [ $R -ne 0 ]; then exit $R; fi
15
+
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if File.file?('Gemfile.erb')
4
+ pwd = Dir.pwd
5
+
6
+ Dir.chdir '..' do
7
+ File.readlines(File.join(pwd, 'Gemfile.erb')).find_all { |line| line[':git'] }.each do |line|
8
+ repo = line[%r{:git => (['"])([^'"]+)\1}, 2]
9
+
10
+ puts "Installing #{repo}"
11
+ system %{git clone #{repo}}
12
+ end
13
+ end
14
+
15
+ puts "Bundling for local environment"
16
+ system %{script/gemfile local}
17
+ else
18
+ puts "Bundling..."
19
+ system %{bundle}
20
+ end
21
+
22
+ puts "Installing git hooks"
23
+ system %{script/install-git-hooks}
24
+
25
+ bundle = File.file?('Gemfile') ? 'bundle exec' : ''
26
+
27
+ command = [ bundle, 'rake', '-s', '-T', 'bootstrap' ]
28
+
29
+ if !(%x{#{command.join(' ')}}).empty?
30
+ puts "Trying to run rake bootstrap..."
31
+ system %{#{bundle} rake bootstrap}
32
+ end
33
+
34
+ puts "Done!"
35
+
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ for hook in script/hooks/* ; do
4
+ ln -sf $PWD/$hook .git/hooks/${hook##*/}
5
+ done
6
+
@@ -0,0 +1,77 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
+ <html>
3
+ <head>
4
+ <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
5
+ <title>Jasmine Test Runner - Generated by jasmine-headless-webkit</title>
6
+ <script type="text/javascript" src="<%= Jasmine::Headless.root.join('vendor/assets/javascripts/prolog.js') %>"></script>
7
+ <%= files.join("\n") %>
8
+ <script type="text/javascript">
9
+ if (window.JHW) { HeadlessReporterResult.specLineNumbers = <%= MultiJson.dump(spec_lines) %>; }
10
+ </script>
11
+ </head>
12
+ <body>
13
+ <script type="text/javascript">
14
+ jasmine.getEnv().console = {
15
+ log: function(msg) { JHW.print('stdout', msg + "\n"); }
16
+ }
17
+
18
+ window._onload = window.onload;
19
+
20
+ window.onload = function() {
21
+ if (window._onload && (window._onload != window.onload)) {
22
+ window._onload();
23
+ }
24
+
25
+ if (window.JHW) {
26
+ <%= jhw_reporters %>
27
+ } else {
28
+ types = [ 'HtmlReporter', 'TrivialReporter' ];
29
+
30
+ for (var i = 0, j = types.length; i < j; ++i) {
31
+ var type = jasmine[types[i]]
32
+ if (type) {
33
+ jasmine.getEnv().addReporter(new type());
34
+ break;
35
+ }
36
+ }
37
+
38
+ var location = window.location.href;
39
+
40
+ var getLastModified = function(callback) {
41
+ var http = new XMLHttpRequest();
42
+ var header;
43
+
44
+ http.open('HEAD', location, true);
45
+
46
+ http.onreadystatechange = function() {
47
+ if(http.readyState === http.DONE) {
48
+ callback(http.getResponseHeader('Last-Modified'));
49
+ }
50
+ };
51
+ http.send();
52
+ }
53
+
54
+ getLastModified(function(currentLastModified) {
55
+ var checker;
56
+ checker = function() {
57
+ setTimeout(function() {
58
+ getLastModified(function(newLastModified) {
59
+ if (currentLastModified != newLastModified) {
60
+ setTimeout(function() { window.location.reload(); }, 1000);
61
+ } else {
62
+ checker();
63
+ }
64
+ });
65
+ }, 3000);
66
+ };
67
+
68
+ checker();
69
+ });
70
+ }
71
+
72
+ jasmine.getEnv().execute();
73
+ }
74
+ </script>
75
+ </body>
76
+ </html>
77
+
Binary file
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'randomize run order' do
4
+ let(:seed) { 100 }
5
+
6
+ it 'should randomize the run order' do
7
+ output = %x{bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --seed #{seed}}
8
+ $?.exitstatus.should == 0
9
+
10
+ output.should include("--seed #{seed}")
11
+ end
12
+ end
13
+
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'specify runner in jasmine.yml' do
4
+ before do
5
+ File.unlink "spec/temp_out.html" if File.file?('spec/temp_out.html')
6
+ end
7
+
8
+ it 'should randomize the run order' do
9
+ output = %x{bin/jasmine-headless-webkit -j spec/jasmine/runner_out_in_jasmine_yml/jasmine.yml}
10
+ $?.exitstatus.should == 2
11
+
12
+ output.should include("made it")
13
+ output.should include("1 test")
14
+
15
+ "spec/temp_out.html".should be_a_file
16
+ end
17
+
18
+ after do
19
+ File.unlink "spec/temp_out.html" if File.file?('spec/temp_out.html')
20
+ end
21
+ end
22
+
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'sprockets' do
4
+ it 'should pull in the code via sprockets' do
5
+ files = %x{bin/jasmine-headless-webkit -l -j spec/jasmine/with_sprockets_includes/with_sprockets_includes.yml}
6
+ $?.exitstatus.should == 0
7
+ files.lines.to_a.should contain_in_order_in_file_list(
8
+ 'assets/application.js.erb: unsupported format',
9
+ 'vendor/assets/javascripts/jquery.js',
10
+ 'templates/that.jst.ejs',
11
+ 'templates/this.jst',
12
+ 'things/jquery.string.js',
13
+ 'assets/things/required.js',
14
+ 'assets/things/code.js',
15
+ 'assets/things/subcode/more_code.js',
16
+ 'spec_helper.js',
17
+ 'spec/things/code_spec.js'
18
+ )
19
+
20
+ files.lines.to_a.any? { |line| line['assets/jquery.string.js: unsupported format'] }.should be_false
21
+ end
22
+ end
23
+
@@ -0,0 +1,5 @@
1
+ function yes() {
2
+ $('body').append('<form action="something" method="post"><button /><form>')
3
+ $('button').trigger('click')
4
+ }
5
+
@@ -0,0 +1,12 @@
1
+ src_files:
2
+ - spec/jasmine/click_button/leave_page.js
3
+
4
+ spec_files:
5
+ - spec/jasmine/click_button/leave_page_spec.js
6
+
7
+ src_dir: .
8
+ spec_dir: .
9
+
10
+ helpers:
11
+ - spec/javascripts/support/jquery-1.6.2.min.js
12
+
@@ -0,0 +1,11 @@
1
+ describe("something", function() {
2
+ it("should be true", function() {
3
+ yes();
4
+ expect(true).toEqual(true);
5
+ });
6
+
7
+ it("should so something else", function() {
8
+ expect(true).toEqual(true);
9
+ });
10
+ });
11
+
@@ -0,0 +1,10 @@
1
+
2
+ src_files:
3
+ - spec/jasmine/coffeescript_error/src.coffee
4
+
5
+ spec_files:
6
+ - spec/jasmine/coffeescript_error/spec.coffee
7
+
8
+ src_dir: .
9
+ spec_dir: .
10
+
@@ -0,0 +1 @@
1
+ var success = 1;
@@ -0,0 +1,10 @@
1
+ src_files:
2
+ - spec/javascripts/support/jquery-1.6.2.min.js
3
+ - spec/jasmine/console_log/console_log.js
4
+
5
+ spec_files:
6
+ - spec/jasmine/console_log/console_log_spec.js
7
+
8
+ src_dir: .
9
+ spec_dir: .
10
+