jasmine-headless-webkit 0.2.3 → 0.4.0

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 (36) hide show
  1. data/Gemfile +1 -0
  2. data/Guardfile +1 -1
  3. data/bin/jasmine-headless-webkit +5 -98
  4. data/ext/jasmine-webkit-specrunner/specrunner.cpp +39 -16
  5. data/jasmine/jasmine.headless-reporter.coffee +3 -3
  6. data/jasmine/jasmine.headless-reporter.js +4 -5
  7. data/lib/jasmine/files_list.rb +122 -0
  8. data/lib/jasmine/headless/cli.rb +17 -0
  9. data/lib/jasmine/headless/errors.rb +7 -0
  10. data/lib/jasmine/headless/options.rb +76 -0
  11. data/lib/jasmine/headless/railtie.rb +29 -0
  12. data/lib/jasmine/headless/runner.rb +75 -0
  13. data/lib/jasmine/headless/task.rb +9 -1
  14. data/lib/jasmine/template_writer.rb +50 -0
  15. data/lib/jasmine-headless-webkit/version.rb +1 -1
  16. data/spec/bin/jasmine-headless-webkit_spec.rb +40 -20
  17. data/spec/jasmine/coffeescript_error/coffeescript_error.yml +10 -0
  18. data/spec/jasmine/coffeescript_error/spec.coffee +2 -0
  19. data/spec/jasmine/coffeescript_error/src.coffee +2 -0
  20. data/spec/jasmine/filtered_failure/failure_spec.js +6 -0
  21. data/spec/jasmine/filtered_failure/filtered_failure.yml +10 -0
  22. data/spec/jasmine/filtered_failure/src.js +0 -0
  23. data/spec/jasmine/filtered_failure/success_spec.js +6 -0
  24. data/spec/jasmine/filtered_success/filtered_success.yml +10 -0
  25. data/spec/jasmine/filtered_success/src.js +0 -0
  26. data/spec/jasmine/filtered_success/success_one_spec.js +6 -0
  27. data/spec/jasmine/filtered_success/success_two_spec.js +6 -0
  28. data/spec/lib/jasmine/files_list_spec.rb +198 -0
  29. data/spec/lib/jasmine/headless/cli_spec.rb +1 -0
  30. data/spec/lib/jasmine/headless/options_spec.rb +69 -0
  31. data/spec/lib/jasmine/headless/runner_spec.rb +72 -0
  32. data/spec/lib/jasmine/template_writer_spec.rb +37 -0
  33. data/spec/spec_helper.rb +15 -0
  34. metadata +42 -7
  35. data/lib/jasmine/cli.rb +0 -78
  36. data/spec/lib/jasmine/cli_spec.rb +0 -89
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jasmine-headless-webkit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.3
5
+ version: 0.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Bintz
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-06-08 00:00:00 -04:00
15
+ date: 2011-06-18 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -80,23 +80,43 @@ files:
80
80
  - lib/autotest/jasmine_rspec2.rb
81
81
  - lib/jasmine-headless-webkit.rb
82
82
  - lib/jasmine-headless-webkit/version.rb
83
- - lib/jasmine/cli.rb
83
+ - lib/jasmine/files_list.rb
84
+ - lib/jasmine/headless/cli.rb
85
+ - lib/jasmine/headless/errors.rb
86
+ - lib/jasmine/headless/options.rb
84
87
  - lib/jasmine/headless/railtie.rb
88
+ - lib/jasmine/headless/runner.rb
85
89
  - lib/jasmine/headless/task.rb
90
+ - lib/jasmine/template_writer.rb
86
91
  - spec/bin/jasmine-headless-webkit_spec.rb
92
+ - spec/jasmine/coffeescript_error/coffeescript_error.yml
93
+ - spec/jasmine/coffeescript_error/spec.coffee
94
+ - spec/jasmine/coffeescript_error/src.coffee
87
95
  - spec/jasmine/console_log/console_log.js
88
96
  - spec/jasmine/console_log/console_log.yml
89
97
  - spec/jasmine/console_log/console_log_spec.js
90
98
  - spec/jasmine/failure/failure.js
91
99
  - spec/jasmine/failure/failure.yml
92
100
  - spec/jasmine/failure/failure_spec.js
101
+ - spec/jasmine/filtered_failure/failure_spec.js
102
+ - spec/jasmine/filtered_failure/filtered_failure.yml
103
+ - spec/jasmine/filtered_failure/src.js
104
+ - spec/jasmine/filtered_failure/success_spec.js
105
+ - spec/jasmine/filtered_success/filtered_success.yml
106
+ - spec/jasmine/filtered_success/src.js
107
+ - spec/jasmine/filtered_success/success_one_spec.js
108
+ - spec/jasmine/filtered_success/success_two_spec.js
93
109
  - spec/jasmine/success/success.js
94
110
  - spec/jasmine/success/success.yml
95
111
  - spec/jasmine/success/success_spec.js
96
112
  - spec/jasmine/success_with_error/success_with_error.js
97
113
  - spec/jasmine/success_with_error/success_with_error.yml
98
114
  - spec/jasmine/success_with_error/success_with_error_spec.js
99
- - spec/lib/jasmine/cli_spec.rb
115
+ - spec/lib/jasmine/files_list_spec.rb
116
+ - spec/lib/jasmine/headless/cli_spec.rb
117
+ - spec/lib/jasmine/headless/options_spec.rb
118
+ - spec/lib/jasmine/headless/runner_spec.rb
119
+ - spec/lib/jasmine/template_writer_spec.rb
100
120
  - spec/spec_helper.rb
101
121
  has_rdoc: true
102
122
  homepage: ""
@@ -112,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
132
  requirements:
113
133
  - - ">="
114
134
  - !ruby/object:Gem::Version
115
- hash: 1748580406864593644
135
+ hash: -433867453609600622
116
136
  segments:
117
137
  - 0
118
138
  version: "0"
@@ -121,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
141
  requirements:
122
142
  - - ">="
123
143
  - !ruby/object:Gem::Version
124
- hash: 1748580406864593644
144
+ hash: -433867453609600622
125
145
  segments:
126
146
  - 0
127
147
  version: "0"
@@ -134,17 +154,32 @@ specification_version: 3
134
154
  summary: Run Jasmine specs headlessly in a WebKit browser
135
155
  test_files:
136
156
  - spec/bin/jasmine-headless-webkit_spec.rb
157
+ - spec/jasmine/coffeescript_error/coffeescript_error.yml
158
+ - spec/jasmine/coffeescript_error/spec.coffee
159
+ - spec/jasmine/coffeescript_error/src.coffee
137
160
  - spec/jasmine/console_log/console_log.js
138
161
  - spec/jasmine/console_log/console_log.yml
139
162
  - spec/jasmine/console_log/console_log_spec.js
140
163
  - spec/jasmine/failure/failure.js
141
164
  - spec/jasmine/failure/failure.yml
142
165
  - spec/jasmine/failure/failure_spec.js
166
+ - spec/jasmine/filtered_failure/failure_spec.js
167
+ - spec/jasmine/filtered_failure/filtered_failure.yml
168
+ - spec/jasmine/filtered_failure/src.js
169
+ - spec/jasmine/filtered_failure/success_spec.js
170
+ - spec/jasmine/filtered_success/filtered_success.yml
171
+ - spec/jasmine/filtered_success/src.js
172
+ - spec/jasmine/filtered_success/success_one_spec.js
173
+ - spec/jasmine/filtered_success/success_two_spec.js
143
174
  - spec/jasmine/success/success.js
144
175
  - spec/jasmine/success/success.yml
145
176
  - spec/jasmine/success/success_spec.js
146
177
  - spec/jasmine/success_with_error/success_with_error.js
147
178
  - spec/jasmine/success_with_error/success_with_error.yml
148
179
  - spec/jasmine/success_with_error/success_with_error_spec.js
149
- - spec/lib/jasmine/cli_spec.rb
180
+ - spec/lib/jasmine/files_list_spec.rb
181
+ - spec/lib/jasmine/headless/cli_spec.rb
182
+ - spec/lib/jasmine/headless/options_spec.rb
183
+ - spec/lib/jasmine/headless/runner_spec.rb
184
+ - spec/lib/jasmine/template_writer_spec.rb
150
185
  - spec/spec_helper.rb
data/lib/jasmine/cli.rb DELETED
@@ -1,78 +0,0 @@
1
- module Jasmine
2
- module CLI
3
- DEFAULTS = {
4
- 'spec_files' => [ '**/*[sS]pec.js' ],
5
- 'helpers' => [ 'helpers/**/*.js' ],
6
- 'spec_dir' => 'spec/javascripts',
7
- 'src_dir' => nil,
8
- 'stylesheets' => [],
9
- 'src_files' => []
10
- }
11
-
12
- RUNNER = 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner'
13
- DEFAULTS_FILE = '.jasmine-headless-webkit'
14
- GLOBAL_DEFAULTS_FILE = File.expand_path("~/#{DEFAULTS_FILE}")
15
-
16
- def process_jasmine_config(overrides = {})
17
- DEFAULTS.merge(overrides)
18
- end
19
-
20
- def read_defaults_files!
21
- [ GLOBAL_DEFAULTS_FILE, DEFAULTS_FILE ].each do |file|
22
- if File.file?(file)
23
- File.readlines(file).collect { |line| line.strip.split(' ', 2) }.each(&@process_options)
24
- end
25
- end
26
- end
27
-
28
- def use_spec?(file)
29
- @spec_filter.empty? || @spec_filter.include?(file)
30
- end
31
-
32
- def jasmine_html_template(files)
33
- <<-HTML
34
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
35
- <html>
36
- <head>
37
- <title>Jasmine Test Runner</title>
38
- <script type="text/javascript">
39
- window.console = { log: function(data) {
40
- JHW.log(JSON.stringify(data));
41
- }, pp: function(data) {
42
- JHW.log(jasmine ? jasmine.pp(data) : JSON.stringify(data));
43
- } };
44
- </script>
45
- #{files.join("\n")}
46
- </head>
47
- <body>
48
-
49
- <script type="text/javascript">
50
- jasmine.getEnv().addReporter(new jasmine.HeadlessReporter());
51
- jasmine.getEnv().execute();
52
- </script>
53
-
54
- </body>
55
- </html>
56
- HTML
57
- end
58
-
59
- def runner_path
60
- @runner_path ||= File.join(gem_dir, RUNNER)
61
- end
62
-
63
- def jasmine_command(options, target)
64
- [
65
- runner_path,
66
- options[:colors] ? '-c' : nil,
67
- options[:report] ? "-r #{options[:report]}" : nil,
68
- target
69
- ].join(" ")
70
- end
71
-
72
- private
73
- def read_config_file(file)
74
-
75
- end
76
- end
77
- end
78
-
@@ -1,89 +0,0 @@
1
- require 'spec_helper'
2
- require 'jasmine/cli'
3
- require 'fakefs/spec_helpers'
4
-
5
- describe Jasmine::CLI do
6
- include Jasmine::CLI
7
- include FakeFS::SpecHelpers
8
-
9
- describe '#process_jasmine_config' do
10
- context 'without overrides' do
11
- let(:config) { {} }
12
-
13
- it "should just return the defaults" do
14
- process_jasmine_config(config).should == {
15
- 'src_files' => [],
16
- 'stylesheets' => [],
17
- 'helpers' => [ 'helpers/**/*.js' ],
18
- 'spec_files' => [ '**/*[sS]pec.js' ],
19
- 'src_dir' => nil,
20
- 'spec_dir' => 'spec/javascripts'
21
- }
22
- end
23
- end
24
-
25
- context 'with overrides' do
26
- let(:config) {
27
- {
28
- 'src_files' => [ 'one', 'two' ],
29
- 'src_dir' => 'this-dir',
30
- 'stylesheets' => [ 'three', 'four' ],
31
- 'helpers' => [ 'five', 'six' ],
32
- 'spec_files' => [ 'seven', 'eight' ],
33
- 'spec_dir' => 'that-dir'
34
- }
35
- }
36
-
37
- it "should return the merged data" do
38
- process_jasmine_config(config).should == config
39
- end
40
- end
41
- end
42
-
43
- describe '#read_defaults_file' do
44
- let(:global_test_data) { %w{first second} }
45
- let(:test_data) { %w{third fourth} }
46
-
47
- before do
48
- File.open(Jasmine::CLI::GLOBAL_DEFAULTS_FILE, 'w') { |fh| fh.puts global_test_data.join(' ') }
49
- File.open(Jasmine::CLI::DEFAULTS_FILE, 'w') { |fh| fh.puts test_data.join(' ') }
50
- end
51
-
52
- it "should read the options" do
53
- all_data = []
54
- @process_options = lambda { |*args| all_data << args.flatten }
55
-
56
- read_defaults_files!
57
-
58
- all_data.should == [ global_test_data, test_data ]
59
- end
60
- end
61
-
62
- describe '#use_spec?' do
63
- let(:spec_file) { 'my/spec.js' }
64
-
65
- context 'no filter provided' do
66
- before do
67
- @spec_filter = []
68
- end
69
-
70
- it "should allow the spec" do
71
- use_spec?(spec_file).should be_true
72
- end
73
- end
74
-
75
- context 'filter provided' do
76
- before do
77
- @spec_filter = [ spec_file ]
78
- end
79
-
80
- it "should use the spec" do
81
- use_spec?(spec_file).should be_true
82
- end
83
-
84
- it "should not use the spec" do
85
- use_spec?('other/file').should be_false
86
- end
87
- end
88
- end
89
- end