jazz_money 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/jasmine/lib/TrivialReporter.js +117 -0
- data/jasmine/lib/consolex.js +28 -0
- data/jasmine/lib/jasmine-0.10.0.js +2261 -0
- data/jasmine/lib/jasmine.css +86 -0
- data/jasmine/lib/json2.js +478 -0
- data/lib/jazz_money/jasmine_runner.rb +95 -0
- data/lib/jazz_money/rspec_thread.rb +76 -0
- data/lib/jazz_money/runner.rb +32 -0
- data/lib/jazz_money.rb +8 -0
- metadata +83 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
module JazzMoney
|
2
|
+
class RspecThread
|
3
|
+
|
4
|
+
require 'spec'
|
5
|
+
|
6
|
+
attr_reader :jasmine_reporter
|
7
|
+
|
8
|
+
def self.start(suites, jasmine_reporter)
|
9
|
+
t = Thread.start do
|
10
|
+
me = new(suites, jasmine_reporter)
|
11
|
+
me.run
|
12
|
+
end
|
13
|
+
t
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(suites, jasmine_reporter)
|
17
|
+
@suites = suites
|
18
|
+
@jasmine_reporter = jasmine_reporter
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
declare_suites
|
23
|
+
Spec::Runner.run
|
24
|
+
end
|
25
|
+
|
26
|
+
def declare_suites
|
27
|
+
me = self
|
28
|
+
@suites.each do |suite|
|
29
|
+
declare_suite(self, suite)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def declare_suite(parent, suite)
|
34
|
+
me = self
|
35
|
+
parent.describe suite["name"] do
|
36
|
+
suite["children"].each do |suite_or_spec|
|
37
|
+
type = suite_or_spec["type"]
|
38
|
+
if type == "suite"
|
39
|
+
me.declare_suite(self, suite_or_spec)
|
40
|
+
elsif type == "spec"
|
41
|
+
me.declare_spec(self, suite_or_spec)
|
42
|
+
else
|
43
|
+
raise "unknown type #{type} for #{suite_or_spec.inspect}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def declare_spec(parent, spec)
|
50
|
+
me = self
|
51
|
+
example_name = spec["name"]
|
52
|
+
spec_id = spec['id']
|
53
|
+
parent.it example_name do
|
54
|
+
while me.jasmine_reporter.results[spec_id].nil?
|
55
|
+
sleep 0.2
|
56
|
+
end
|
57
|
+
me.report_spec(me.jasmine_reporter.results[spec_id])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def report_spec(spec_results)
|
62
|
+
if (spec_results['result'] != 'passed')
|
63
|
+
|
64
|
+
fail_messages_hashes = spec_results['messages'].reject {|message| message["message"] =~ /Passed/}
|
65
|
+
all_fail_messages = []
|
66
|
+
fail_messages_hashes.each do |message|
|
67
|
+
all_fail_messages << message["message"]
|
68
|
+
js_stack_lines = message["stack_trace"].split("\n").select {|stack_line| stack_line =~ /spec\/javascript/}
|
69
|
+
js_stack_lines.each {|stack_line| all_fail_messages << stack_line.gsub("()@", "./")}
|
70
|
+
end
|
71
|
+
|
72
|
+
Spec::Expectations.fail_with(all_fail_messages.join("\n"))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module JazzMoney
|
2
|
+
|
3
|
+
class Runner
|
4
|
+
|
5
|
+
def initialize(js_includes, jasmine_spec_files)
|
6
|
+
@page = Harmony::Page.new
|
7
|
+
@jasmine_runner = JasmineRunner.new(@page, jasmine_spec_files, js_includes, self)
|
8
|
+
@js_includes = js_includes
|
9
|
+
@jasmine_spec_files = jasmine_spec_files
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
@jasmine_runner.start
|
14
|
+
|
15
|
+
# johnson is not thread-safe, so serialize the suites into ruby objects
|
16
|
+
suites = JSON.parse(@page.execute_js('JSON.stringify(jsApiReporter.suites());'))
|
17
|
+
rspec_thread = RspecThread.start(suites, self)
|
18
|
+
@jasmine_runner.wait
|
19
|
+
rspec_thread.join
|
20
|
+
end
|
21
|
+
|
22
|
+
def report_spec_results(spec_id, results_for_spec)
|
23
|
+
results[spec_id] = JSON.parse(results_for_spec)
|
24
|
+
end
|
25
|
+
|
26
|
+
def results
|
27
|
+
@results ||= {};
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
data/lib/jazz_money.rb
ADDED
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jazz_money
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Mike Grafton
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-05-07 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: harmony
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 5
|
30
|
+
- 4
|
31
|
+
version: 0.5.4
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Jasmine + Harmony
|
35
|
+
email: mike@pivotallabs.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- lib/jazz_money.rb
|
44
|
+
- lib/jazz_money/runner.rb
|
45
|
+
- lib/jazz_money/rspec_thread.rb
|
46
|
+
- lib/jazz_money/jasmine_runner.rb
|
47
|
+
- jasmine/lib/TrivialReporter.js
|
48
|
+
- jasmine/lib/consolex.js
|
49
|
+
- jasmine/lib/jasmine-0.10.0.js
|
50
|
+
- jasmine/lib/jasmine.css
|
51
|
+
- jasmine/lib/json2.js
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://github.com/pivotalexperimental/jazz_money
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project: ""
|
78
|
+
rubygems_version: 1.3.6
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Jasmine + Harmony
|
82
|
+
test_files: []
|
83
|
+
|