jasmine 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +1 -0
- data/Gemfile +1 -8
- data/RELEASE_NOTES.markdown +6 -0
- data/lib/jasmine.rb +8 -2
- data/lib/jasmine/application.rb +40 -0
- data/lib/jasmine/asset_pipeline_mapper.rb +20 -0
- data/lib/jasmine/base.rb +1 -1
- data/lib/jasmine/config.rb +12 -73
- data/lib/jasmine/dependencies.rb +4 -0
- data/lib/jasmine/page.rb +1 -1
- data/lib/jasmine/results.rb +19 -0
- data/lib/jasmine/results_processor.rb +37 -0
- data/lib/jasmine/rspec_formatter.rb +92 -0
- data/lib/jasmine/run.html.erb +1 -0
- data/lib/jasmine/run_specs.rb +33 -0
- data/lib/jasmine/runner_config.rb +60 -0
- data/lib/jasmine/runners/http.rb +70 -0
- data/lib/jasmine/selenium_driver.rb +0 -14
- data/lib/jasmine/server.rb +14 -35
- data/lib/jasmine/tasks/jasmine.rake +2 -2
- data/lib/jasmine/version.rb +1 -1
- data/lib/rack/jasmine/focused_suite.rb +3 -3
- data/spec/application_spec.rb +99 -0
- data/spec/asset_pipeline_mapper_spec.rb +18 -0
- data/spec/config_spec.rb +32 -67
- data/spec/dependencies_spec.rb +14 -3
- data/spec/jasmine_self_test_spec.rb +16 -16
- data/spec/page_spec.rb +1 -1
- data/spec/results_processor_spec.rb +3 -0
- data/spec/results_spec.rb +27 -0
- data/spec/rspec_formatter_spec.rb +88 -0
- data/spec/runner_config_spec.rb +131 -0
- data/spec/server_spec.rb +34 -81
- metadata +44 -24
- data/lib/jasmine/runner.rb +0 -32
- data/lib/jasmine/spec_builder.rb +0 -162
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-08-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement: &
|
18
|
+
requirement: &70248187660320 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 2.5.0
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70248187660320
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
|
-
requirement: &
|
29
|
+
requirement: &70248187649880 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 3.0.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70248187649880
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rack
|
40
|
-
requirement: &
|
40
|
+
requirement: &70248187648920 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 1.2.1
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70248187648920
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rack-test
|
51
|
-
requirement: &
|
51
|
+
requirement: &70248187648060 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70248187648060
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: json_pure
|
62
|
-
requirement: &
|
62
|
+
requirement: &70248187645900 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70248187645900
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: nokogiri
|
73
|
-
requirement: &
|
73
|
+
requirement: &70248187644700 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70248187644700
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: jasmine-core
|
84
|
-
requirement: &
|
84
|
+
requirement: &70248187643700 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: 1.2.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70248187643700
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rack
|
95
|
-
requirement: &
|
95
|
+
requirement: &70248187625440 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ~>
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '1.0'
|
101
101
|
type: :runtime
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70248187625440
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: rspec
|
106
|
-
requirement: &
|
106
|
+
requirement: &70248187624740 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: 1.3.1
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70248187624740
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: selenium-webdriver
|
117
|
-
requirement: &
|
117
|
+
requirement: &70248187624080 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ! '>='
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
version: 0.1.3
|
123
123
|
type: :runtime
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70248187624080
|
126
126
|
description: Test your JavaScript without any framework dependencies, in any environment,
|
127
127
|
and with a nice descriptive syntax.
|
128
128
|
email: jasmine-js@googlegroups.com
|
@@ -132,12 +132,14 @@ extensions: []
|
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
134
|
- .gitignore
|
135
|
+
- .rspec
|
135
136
|
- .travis.yml
|
136
137
|
- Gemfile
|
137
138
|
- HOW_TO_TEST.markdown
|
138
139
|
- MIT.LICENSE
|
139
140
|
- README.markdown
|
140
141
|
- RELEASE.markdown
|
142
|
+
- RELEASE_NOTES.markdown
|
141
143
|
- Rakefile
|
142
144
|
- bin/jasmine
|
143
145
|
- generators/jasmine/jasmine_generator.rb
|
@@ -162,6 +164,8 @@ files:
|
|
162
164
|
- lib/generators/jasmine/install/templates/spec/javascripts/helpers/.gitkeep
|
163
165
|
- lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml
|
164
166
|
- lib/jasmine.rb
|
167
|
+
- lib/jasmine/application.rb
|
168
|
+
- lib/jasmine/asset_pipeline_mapper.rb
|
165
169
|
- lib/jasmine/base.rb
|
166
170
|
- lib/jasmine/command_line_tool.rb
|
167
171
|
- lib/jasmine/config.rb
|
@@ -172,11 +176,15 @@ files:
|
|
172
176
|
- lib/jasmine/firebug/firebug.rb
|
173
177
|
- lib/jasmine/page.rb
|
174
178
|
- lib/jasmine/railtie.rb
|
179
|
+
- lib/jasmine/results.rb
|
180
|
+
- lib/jasmine/results_processor.rb
|
181
|
+
- lib/jasmine/rspec_formatter.rb
|
175
182
|
- lib/jasmine/run.html.erb
|
176
|
-
- lib/jasmine/
|
183
|
+
- lib/jasmine/run_specs.rb
|
184
|
+
- lib/jasmine/runner_config.rb
|
185
|
+
- lib/jasmine/runners/http.rb
|
177
186
|
- lib/jasmine/selenium_driver.rb
|
178
187
|
- lib/jasmine/server.rb
|
179
|
-
- lib/jasmine/spec_builder.rb
|
180
188
|
- lib/jasmine/tasks/jasmine.rake
|
181
189
|
- lib/jasmine/tasks/jasmine_rails3.rake
|
182
190
|
- lib/jasmine/version.rb
|
@@ -184,6 +192,8 @@ files:
|
|
184
192
|
- lib/rack/jasmine/focused_suite.rb
|
185
193
|
- lib/rack/jasmine/redirect.rb
|
186
194
|
- lib/rack/jasmine/runner.rb
|
195
|
+
- spec/application_spec.rb
|
196
|
+
- spec/asset_pipeline_mapper_spec.rb
|
187
197
|
- spec/config_spec.rb
|
188
198
|
- spec/dependencies_spec.rb
|
189
199
|
- spec/fixture/Rakefile
|
@@ -199,6 +209,10 @@ files:
|
|
199
209
|
- spec/jasmine_self_test_spec.rb
|
200
210
|
- spec/page_spec.rb
|
201
211
|
- spec/rack/jasmine/runner_spec.rb
|
212
|
+
- spec/results_processor_spec.rb
|
213
|
+
- spec/results_spec.rb
|
214
|
+
- spec/rspec_formatter_spec.rb
|
215
|
+
- spec/runner_config_spec.rb
|
202
216
|
- spec/server_spec.rb
|
203
217
|
- spec/spec_helper.rb
|
204
218
|
homepage: http://pivotal.github.com/jasmine
|
@@ -227,6 +241,8 @@ signing_key:
|
|
227
241
|
specification_version: 3
|
228
242
|
summary: JavaScript BDD framework
|
229
243
|
test_files:
|
244
|
+
- spec/application_spec.rb
|
245
|
+
- spec/asset_pipeline_mapper_spec.rb
|
230
246
|
- spec/config_spec.rb
|
231
247
|
- spec/dependencies_spec.rb
|
232
248
|
- spec/fixture/Rakefile
|
@@ -242,5 +258,9 @@ test_files:
|
|
242
258
|
- spec/jasmine_self_test_spec.rb
|
243
259
|
- spec/page_spec.rb
|
244
260
|
- spec/rack/jasmine/runner_spec.rb
|
261
|
+
- spec/results_processor_spec.rb
|
262
|
+
- spec/results_spec.rb
|
263
|
+
- spec/rspec_formatter_spec.rb
|
264
|
+
- spec/runner_config_spec.rb
|
245
265
|
- spec/server_spec.rb
|
246
266
|
- spec/spec_helper.rb
|
data/lib/jasmine/runner.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'jasmine'
|
5
|
-
jasmine_config_overrides = File.expand_path(File.join(Dir.pwd, 'spec', 'javascripts', 'support', 'jasmine_config.rb'))
|
6
|
-
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
|
7
|
-
if Jasmine::Dependencies.rspec2?
|
8
|
-
require 'rspec'
|
9
|
-
else
|
10
|
-
require 'spec'
|
11
|
-
end
|
12
|
-
|
13
|
-
jasmine_config = Jasmine::Config.new
|
14
|
-
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
15
|
-
|
16
|
-
should_stop = false
|
17
|
-
|
18
|
-
if Jasmine::Dependencies.rspec2?
|
19
|
-
RSpec.configuration.after(:suite) do
|
20
|
-
spec_builder.stop if should_stop
|
21
|
-
end
|
22
|
-
else
|
23
|
-
Spec::Runner.configure do |config|
|
24
|
-
config.after(:suite) do
|
25
|
-
spec_builder.stop if should_stop
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
spec_builder.start
|
31
|
-
should_stop = true
|
32
|
-
spec_builder.declare_suites
|
data/lib/jasmine/spec_builder.rb
DELETED
@@ -1,162 +0,0 @@
|
|
1
|
-
require 'enumerator'
|
2
|
-
|
3
|
-
module Jasmine
|
4
|
-
class SpecBuilder
|
5
|
-
attr_accessor :suites
|
6
|
-
|
7
|
-
def initialize(config)
|
8
|
-
@config = config
|
9
|
-
@spec_files = config.spec_files
|
10
|
-
@runner = config
|
11
|
-
@spec_ids = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def start
|
15
|
-
guess_example_locations
|
16
|
-
|
17
|
-
@runner.start
|
18
|
-
load_suite_info
|
19
|
-
wait_for_suites_to_finish_running
|
20
|
-
end
|
21
|
-
|
22
|
-
def stop
|
23
|
-
@runner.stop
|
24
|
-
end
|
25
|
-
|
26
|
-
def script_path
|
27
|
-
File.expand_path(__FILE__)
|
28
|
-
end
|
29
|
-
|
30
|
-
def guess_example_locations
|
31
|
-
@example_locations = {}
|
32
|
-
|
33
|
-
example_name_parts = []
|
34
|
-
previous_indent_level = 0
|
35
|
-
@config.spec_files_full_paths.each do |filename|
|
36
|
-
line_number = 1
|
37
|
-
File.open(filename, "r") do |file|
|
38
|
-
file.readlines.each do |line|
|
39
|
-
match = /^(\s*)(describe|it)\s*\(\s*["'](.*)["']\s*,\s*function/.match(line)
|
40
|
-
if (match)
|
41
|
-
indent_level = match[1].length / 2
|
42
|
-
example_name = match[3]
|
43
|
-
example_name_parts[indent_level] = example_name
|
44
|
-
|
45
|
-
full_example_name = example_name_parts.slice(0, indent_level + 1).join(" ")
|
46
|
-
@example_locations[full_example_name] = "#{filename}:#{line_number}: in `it'"
|
47
|
-
end
|
48
|
-
line_number += 1
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def load_suite_info
|
55
|
-
started = Time.now
|
56
|
-
while !eval_js('return jsApiReporter && jsApiReporter.started') do
|
57
|
-
raise "couldn't connect to Jasmine after 60 seconds" if (started + 60 < Time.now)
|
58
|
-
sleep 0.1
|
59
|
-
end
|
60
|
-
|
61
|
-
@suites = eval_js("var result = jsApiReporter.suites(); if (window.Prototype && Object.toJSON) { return Object.toJSON(result) } else { return JSON.stringify(result) }")
|
62
|
-
end
|
63
|
-
|
64
|
-
def results_for(spec_id)
|
65
|
-
@spec_results ||= load_results
|
66
|
-
@spec_results[spec_id.to_s]
|
67
|
-
end
|
68
|
-
|
69
|
-
def load_results
|
70
|
-
@spec_results = {}
|
71
|
-
@spec_ids.each_slice(50) do |slice|
|
72
|
-
@spec_results.merge!(eval_js("var result = jsApiReporter.resultsForSpecs(#{json_generate(slice)}); if (window.Prototype && Object.toJSON) { return Object.toJSON(result) } else { return JSON.stringify(result) }"))
|
73
|
-
end
|
74
|
-
@spec_results
|
75
|
-
end
|
76
|
-
|
77
|
-
def wait_for_suites_to_finish_running
|
78
|
-
puts "Waiting for suite to finish in browser ..."
|
79
|
-
while !eval_js('return jsApiReporter.finished') do
|
80
|
-
sleep 0.1
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def declare_suites
|
85
|
-
me = self
|
86
|
-
suites.each do |suite|
|
87
|
-
declare_suite(self, suite)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def declare_suite(parent, suite)
|
92
|
-
me = self
|
93
|
-
parent.describe suite["name"] do
|
94
|
-
suite["children"].each do |suite_or_spec|
|
95
|
-
type = suite_or_spec["type"]
|
96
|
-
if type == "suite"
|
97
|
-
me.declare_suite(self, suite_or_spec)
|
98
|
-
elsif type == "spec"
|
99
|
-
me.declare_spec(self, suite_or_spec)
|
100
|
-
else
|
101
|
-
raise "unknown type #{type} for #{suite_or_spec.inspect}"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def declare_spec(parent, spec)
|
108
|
-
me = self
|
109
|
-
example_name = spec["name"]
|
110
|
-
@spec_ids << spec["id"]
|
111
|
-
backtrace = @example_locations[parent.description + " " + example_name]
|
112
|
-
if Jasmine::Dependencies.rspec2?
|
113
|
-
parent.it example_name, {} do
|
114
|
-
me.report_spec(spec["id"])
|
115
|
-
end
|
116
|
-
else
|
117
|
-
parent.it example_name, {}, backtrace do
|
118
|
-
me.report_spec(spec["id"])
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def report_spec(spec_id)
|
124
|
-
spec_results = results_for(spec_id)
|
125
|
-
out = ""
|
126
|
-
messages = spec_results['messages'].each do |message|
|
127
|
-
case
|
128
|
-
when message["type"] == "log"
|
129
|
-
puts message["text"]
|
130
|
-
puts "\n"
|
131
|
-
else
|
132
|
-
unless message["message"] =~ /^Passed.$/
|
133
|
-
STDERR << message["message"]
|
134
|
-
STDERR << "\n"
|
135
|
-
|
136
|
-
out << message["message"]
|
137
|
-
out << "\n"
|
138
|
-
end
|
139
|
-
|
140
|
-
if !message["passed"] && message["trace"]["stack"]
|
141
|
-
stack_trace = message["trace"]["stack"].gsub(/<br \/>/, "\n").gsub(/<\/?b>/, " ")
|
142
|
-
STDERR << stack_trace.gsub(/\(.*\)@http:\/\/localhost:[0-9]+\/specs\//, "/spec/")
|
143
|
-
STDERR << "\n"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
148
|
-
fail out unless spec_results['result'] == 'passed'
|
149
|
-
puts out unless out.empty?
|
150
|
-
end
|
151
|
-
|
152
|
-
private
|
153
|
-
|
154
|
-
def eval_js(js)
|
155
|
-
@runner.eval_js(js)
|
156
|
-
end
|
157
|
-
|
158
|
-
def json_generate(obj)
|
159
|
-
@runner.json_generate(obj)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|