gusto 1.0.0.beta8 → 1.0.0.beta9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HtmlReport.coffee +1 -5
- data/lib/Spec/RootSuite.coffee +8 -0
- data/lib/Spec.coffee +1 -0
- data/lib/gusto/cli_renderer.rb +74 -0
- data/lib/gusto/server.rb +1 -0
- data/lib/gusto/version.rb +1 -1
- data/lib/gusto.rb +23 -17
- data/views/index.slim +6 -5
- metadata +4 -17
- data/public/jquery-1.10.2.js +0 -9789
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4401a2967b016a74b76bc70b3c81e299f04436a
|
4
|
+
data.tar.gz: a266269b65fdbd960acd872992133bcdb65c135d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb1ec2b810205bbd1fb371d137ccae69951315a66b6260fa5f33ada1cdadaa3539f0ca9f763d3ed2d75910dc44ddb5ad0fe292a1854887d2c96355731a866ee
|
7
|
+
data.tar.gz: 59a1f8d9caa50163d5bd8925217feffe97b6055fcfe2e221d247eb58b0deab0d13cc376c871591cd1828775a66e8bf2cddc407de33b35c3ac27f6ea0085c80d7
|
data/lib/HtmlReport.coffee
CHANGED
data/lib/Spec.coffee
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
module Gusto
|
2
|
+
class CliRenderer
|
3
|
+
PASSED = 0
|
4
|
+
PENDING = 1
|
5
|
+
FAILED = 2
|
6
|
+
|
7
|
+
attr :root_report
|
8
|
+
|
9
|
+
def initialize(root_report)
|
10
|
+
@root_report = root_report
|
11
|
+
end
|
12
|
+
|
13
|
+
def render
|
14
|
+
[body, footer].compact.reject(&:empty?).join("\n\n")
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def body
|
20
|
+
root_report['subreports'].map do |subreport|
|
21
|
+
report_and_subreport_results subreport
|
22
|
+
end.flatten.join "\n"
|
23
|
+
end
|
24
|
+
|
25
|
+
def report_and_subreport_results(report)
|
26
|
+
[report_result(report)] + report['subreports'].map do |subreport|
|
27
|
+
indented_report_and_subreport_results(subreport)
|
28
|
+
end.flatten
|
29
|
+
end
|
30
|
+
|
31
|
+
def indented_report_and_subreport_results(report)
|
32
|
+
report_and_subreport_results(report).map do |result|
|
33
|
+
" #{result}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def report_result(report)
|
38
|
+
result_color report['status'], report['title']
|
39
|
+
end
|
40
|
+
|
41
|
+
def footer
|
42
|
+
result_color root_report['status'], "#{total} total, #{passed} passed, #{pending} pending, #{failed} failed"
|
43
|
+
end
|
44
|
+
|
45
|
+
def total
|
46
|
+
root_report['counts'].inject(0, &:+)
|
47
|
+
end
|
48
|
+
|
49
|
+
def passed
|
50
|
+
root_report['counts'][PASSED]
|
51
|
+
end
|
52
|
+
|
53
|
+
def pending
|
54
|
+
root_report['counts'][PENDING]
|
55
|
+
end
|
56
|
+
|
57
|
+
def failed
|
58
|
+
root_report['counts'][FAILED]
|
59
|
+
end
|
60
|
+
|
61
|
+
def result_color(result, string)
|
62
|
+
case result
|
63
|
+
when PASSED
|
64
|
+
"\e[32m#{string}\e[0m"
|
65
|
+
when PENDING
|
66
|
+
"\e[33m#{string}\e[0m"
|
67
|
+
when FAILED
|
68
|
+
"\e[31m#{string}\e[0m"
|
69
|
+
else
|
70
|
+
string
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/gusto/server.rb
CHANGED
data/lib/gusto/version.rb
CHANGED
data/lib/gusto.rb
CHANGED
@@ -7,10 +7,15 @@ require 'rack'
|
|
7
7
|
require 'json'
|
8
8
|
require File.join(File.dirname(__FILE__), 'gusto', 'version')
|
9
9
|
|
10
|
+
|
10
11
|
module Gusto
|
11
12
|
autoload :Configuration, File.join(File.dirname(__FILE__), 'gusto', 'configuration')
|
12
13
|
autoload :Server, File.join(File.dirname(__FILE__), 'gusto', 'server')
|
13
14
|
autoload :Sprockets, File.join(File.dirname(__FILE__), 'gusto', 'sprockets')
|
15
|
+
autoload :CliRenderer, File.join(File.dirname(__FILE__), 'gusto', 'cli_renderer')
|
16
|
+
|
17
|
+
HEADLESS_RUNNER_PATH = File.realpath(
|
18
|
+
File.join(File.dirname(__FILE__), '..', 'phantom', 'headless_runner.js'))
|
14
19
|
|
15
20
|
class << self
|
16
21
|
def root
|
@@ -33,35 +38,36 @@ module Gusto
|
|
33
38
|
|
34
39
|
def cli
|
35
40
|
trap_sigint
|
36
|
-
spawn_server
|
37
|
-
result = run_suite
|
41
|
+
spawn_server(quiet: true)
|
42
|
+
result = run_suite?
|
38
43
|
shut_down(result ? 0 : 1)
|
39
44
|
end
|
40
45
|
|
41
46
|
def autotest
|
42
47
|
trap_sigint
|
43
48
|
spawn_server
|
44
|
-
run_suite
|
49
|
+
run_suite?
|
45
50
|
watch_for_changes
|
46
51
|
Process.waitall
|
47
52
|
end
|
48
53
|
|
49
|
-
def spawn_server
|
50
|
-
@server = Process.fork
|
54
|
+
def spawn_server(options={})
|
55
|
+
@server = Process.fork do
|
56
|
+
if options[:quiet]
|
57
|
+
$stdout.reopen "/dev/null", "w"
|
58
|
+
$stderr.reopen "/dev/null", "w"
|
59
|
+
end
|
60
|
+
$0 = 'gusto server'
|
61
|
+
Server.start
|
62
|
+
end
|
51
63
|
wait_for_server_at(root_url)
|
52
64
|
end
|
53
65
|
|
54
|
-
def run_suite
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@browser = Selenium::WebDriver.for :firefox, profile: Selenium::WebDriver::Firefox::Profile.new
|
60
|
-
@browser.get "#{root_url}#terminal"
|
61
|
-
end
|
62
|
-
result = @browser[css: '.results'].text
|
63
|
-
puts result
|
64
|
-
!!result.match('passed, 0 failed')
|
66
|
+
def run_suite?
|
67
|
+
json = `phantomjs #{Shellwords.escape HEADLESS_RUNNER_PATH} #{Configuration.port}`
|
68
|
+
report = JSON.parse json
|
69
|
+
puts CliRenderer.new(report).render
|
70
|
+
report['status'] != 2
|
65
71
|
end
|
66
72
|
|
67
73
|
def watch_for_changes
|
@@ -93,7 +99,7 @@ module Gusto
|
|
93
99
|
private
|
94
100
|
|
95
101
|
def wait_for_server_at(url)
|
96
|
-
|
102
|
+
Net::HTTP.get URI.parse(url)
|
97
103
|
rescue Errno::ECONNREFUSED
|
98
104
|
sleep 1
|
99
105
|
retry
|
data/views/index.slim
CHANGED
@@ -11,8 +11,9 @@ head
|
|
11
11
|
== javascript_tag(script) + "\n"
|
12
12
|
|
13
13
|
body
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
- unless @headless
|
15
|
+
javascript:
|
16
|
+
$(function() {
|
17
|
+
window.report = new HtmlReport(document.body);
|
18
|
+
report.run();
|
19
|
+
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gusto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Cohen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: selenium-webdriver
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '>='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: listen
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +142,7 @@ files:
|
|
156
142
|
- lib/gusto/configuration.rb
|
157
143
|
- lib/gusto/version.rb
|
158
144
|
- lib/gusto/server.rb
|
145
|
+
- lib/gusto/cli_renderer.rb
|
159
146
|
- lib/gusto/runner.rb
|
160
147
|
- lib/Spec/Matchers.coffee
|
161
148
|
- lib/Spec/Mock.coffee
|
@@ -165,12 +152,12 @@ files:
|
|
165
152
|
- lib/Spec/DSL.coffee
|
166
153
|
- lib/Spec/Report.coffee
|
167
154
|
- lib/Spec/Test.coffee
|
155
|
+
- lib/Spec/RootSuite.coffee
|
168
156
|
- lib/Spec/Util.coffee
|
169
157
|
- lib/Spec/Suite.coffee
|
170
158
|
- lib/Spec/DelayedExpectation.coffee
|
171
159
|
- public/jsdiff.js
|
172
160
|
- public/ie.js
|
173
|
-
- public/jquery-1.10.2.js
|
174
161
|
- public/jquery-1.5.2.js
|
175
162
|
- public/stacktrace.js
|
176
163
|
- views/index.slim
|