specjour 0.7.0 → 2.0.0.rc1
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.
- checksums.yaml +7 -0
- data/History.markdown +12 -0
- data/README.markdown +24 -1
- data/Rakefile +12 -12
- data/bin/specjour +3 -1
- data/lib/specjour/cli.rb +86 -110
- data/lib/specjour/colors.rb +23 -0
- data/lib/specjour/configuration.rb +47 -91
- data/lib/specjour/connection.rb +69 -20
- data/lib/specjour/cpu.rb +4 -0
- data/lib/specjour/fork.rb +1 -1
- data/lib/specjour/formatter.rb +153 -0
- data/lib/specjour/listener.rb +181 -0
- data/lib/specjour/loader.rb +55 -119
- data/lib/specjour/logger.rb +34 -0
- data/lib/specjour/plugin/base.rb +61 -0
- data/lib/specjour/plugin/manager.rb +28 -0
- data/lib/specjour/plugin/rails.rb +47 -0
- data/lib/specjour/plugin/rails_v3.rb +23 -0
- data/lib/specjour/plugin/rails_v4.rb +25 -0
- data/lib/specjour/plugin/rspec.rb +160 -0
- data/lib/specjour/plugin/rspec_v2.rb +53 -0
- data/lib/specjour/plugin/rspec_v3.rb +59 -0
- data/lib/specjour/plugin/ssh.rb +24 -0
- data/lib/specjour/plugin.rb +4 -0
- data/lib/specjour/printer.rb +235 -67
- data/lib/specjour/protocol.rb +13 -6
- data/lib/specjour/rspec_formatter.rb +17 -0
- data/lib/specjour/rsync_daemon.rb +6 -3
- data/lib/specjour/socket_helper.rb +26 -10
- data/lib/specjour/worker.rb +36 -62
- data/lib/specjour.rb +50 -24
- data/lib/specjour_plugin.rb +5 -0
- metadata +52 -84
- data/lib/specjour/cucumber/distributed_formatter.rb +0 -82
- data/lib/specjour/cucumber/final_report.rb +0 -83
- data/lib/specjour/cucumber/preloader.rb +0 -22
- data/lib/specjour/cucumber/runner.rb +0 -15
- data/lib/specjour/cucumber.rb +0 -16
- data/lib/specjour/db_scrub.rb +0 -56
- data/lib/specjour/dispatcher.rb +0 -170
- data/lib/specjour/manager.rb +0 -174
- data/lib/specjour/rspec/distributed_formatter.rb +0 -50
- data/lib/specjour/rspec/final_report.rb +0 -73
- data/lib/specjour/rspec/marshalable_exception.rb +0 -19
- data/lib/specjour/rspec/preloader.rb +0 -15
- data/lib/specjour/rspec/runner.rb +0 -14
- data/lib/specjour/rspec/shared_example_group_ext.rb +0 -9
- data/lib/specjour/rspec.rb +0 -17
data/lib/specjour.rb
CHANGED
@@ -1,27 +1,33 @@
|
|
1
|
-
require '
|
1
|
+
require 'tmpdir'
|
2
2
|
|
3
3
|
autoload :URI, 'uri'
|
4
4
|
autoload :Forwardable, 'forwardable'
|
5
|
-
autoload :GServer, 'gserver'
|
6
5
|
autoload :Timeout, 'timeout'
|
7
6
|
autoload :Benchmark, 'benchmark'
|
8
7
|
autoload :Logger, 'logger'
|
9
8
|
autoload :Socket, 'socket'
|
10
9
|
autoload :StringIO, 'stringio'
|
11
10
|
autoload :OpenStruct, 'ostruct'
|
11
|
+
autoload :Pathname, 'pathname'
|
12
12
|
|
13
13
|
module Specjour
|
14
14
|
autoload :CLI, 'specjour/cli'
|
15
|
+
autoload :Colors, 'specjour/colors'
|
15
16
|
autoload :CPU, 'specjour/cpu'
|
16
17
|
autoload :Configuration, 'specjour/configuration'
|
17
18
|
autoload :Connection, 'specjour/connection'
|
18
19
|
autoload :DbScrub, 'specjour/db_scrub'
|
19
20
|
autoload :Dispatcher, 'specjour/dispatcher'
|
20
21
|
autoload :Fork, 'specjour/fork'
|
22
|
+
autoload :Formatter, 'specjour/formatter'
|
23
|
+
autoload :Listener, 'specjour/listener'
|
24
|
+
autoload :Logger, 'specjour/logger'
|
21
25
|
autoload :Loader, 'specjour/loader'
|
22
26
|
autoload :Manager, 'specjour/manager'
|
27
|
+
autoload :Plugin, 'specjour/plugin'
|
23
28
|
autoload :Printer, 'specjour/printer'
|
24
29
|
autoload :Protocol, 'specjour/protocol'
|
30
|
+
autoload :RspecFormatter, "specjour/rspec_formatter"
|
25
31
|
autoload :RsyncDaemon, 'specjour/rsync_daemon'
|
26
32
|
autoload :SocketHelper, 'specjour/socket_helper'
|
27
33
|
autoload :Worker, 'specjour/worker'
|
@@ -29,30 +35,49 @@ module Specjour
|
|
29
35
|
autoload :Cucumber, 'specjour/cucumber'
|
30
36
|
autoload :RSpec, 'specjour/rspec'
|
31
37
|
|
32
|
-
VERSION ||= "0.
|
38
|
+
VERSION ||= "2.0.0.rc1"
|
33
39
|
HOOKS_PATH ||= "./.specjour/hooks.rb"
|
34
40
|
PROGRAM_NAME ||= $PROGRAM_NAME # keep a reference of the original program name
|
41
|
+
Time = Time.dup
|
35
42
|
|
36
43
|
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
|
37
44
|
|
38
45
|
class Error < StandardError; end
|
39
46
|
|
47
|
+
def self.benchmark(msg)
|
48
|
+
$stderr.print "#{msg}... "
|
49
|
+
start_time = Time.now
|
50
|
+
yield
|
51
|
+
ensure
|
52
|
+
$stderr.puts "completed in #{Time.now - start_time}s"
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.configuration(provided_config=nil)
|
56
|
+
if provided_config
|
57
|
+
@configuration = provided_config
|
58
|
+
elsif !instance_variable_defined?(:@configuration)
|
59
|
+
@configuration = Configuration.new
|
60
|
+
else
|
61
|
+
@configuration
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
40
65
|
def self.interrupted?
|
41
66
|
@interrupted
|
42
67
|
end
|
43
68
|
|
44
69
|
def self.interrupted=(bool)
|
45
70
|
@interrupted = bool
|
46
|
-
if bool
|
47
|
-
will_quit(:RSpec)
|
48
|
-
will_quit(:Cucumber)
|
49
|
-
end
|
50
71
|
end
|
51
72
|
|
52
|
-
def self.
|
53
|
-
if
|
54
|
-
|
55
|
-
|
73
|
+
def self.load_custom_hooks
|
74
|
+
load HOOKS_PATH if File.exists?(HOOKS_PATH)
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.load_plugins
|
78
|
+
$LOAD_PATH.each do |load_path|
|
79
|
+
file = File.expand_path("specjour_plugin.rb", load_path)
|
80
|
+
require file if File.exists?(file)
|
56
81
|
end
|
57
82
|
end
|
58
83
|
|
@@ -60,30 +85,31 @@ module Specjour
|
|
60
85
|
@logger ||= new_logger
|
61
86
|
end
|
62
87
|
|
63
|
-
def self.new_logger(level = Logger::UNKNOWN)
|
64
|
-
@logger = Logger.new $stderr
|
88
|
+
def self.new_logger(level = ::Logger::UNKNOWN, output=nil)
|
89
|
+
@logger = ::Logger.new output || $stderr
|
65
90
|
@logger.level = level
|
91
|
+
@logger.formatter = lambda do |severity, datetime, progname, message|
|
92
|
+
"[#{severity} #{datetime.strftime("%I:%M:%S")}] #{progname}: #{message}\n"
|
93
|
+
end
|
66
94
|
@logger
|
67
95
|
end
|
68
96
|
|
69
|
-
def self.
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.load_custom_hooks
|
74
|
-
load HOOKS_PATH if File.exists?(HOOKS_PATH)
|
97
|
+
def self.plugin_manager
|
98
|
+
@plugin_manager ||= Specjour::Plugin::Manager.new
|
75
99
|
end
|
76
100
|
|
77
101
|
def self.trap_interrupt
|
78
102
|
Signal.trap('INT') do
|
79
103
|
self.interrupted = true
|
80
|
-
|
104
|
+
plugin_manager.send_task(:interrupted!)
|
81
105
|
end
|
82
106
|
end
|
83
107
|
|
84
|
-
def self.
|
85
|
-
|
86
|
-
|
87
|
-
|
108
|
+
def self.trap_interrupt_with_exit
|
109
|
+
trap_interrupt
|
110
|
+
old_int = Signal.trap("INT") do
|
111
|
+
old_int.call()
|
112
|
+
abort("ABORTING\n")
|
113
|
+
end
|
88
114
|
end
|
89
115
|
end
|
metadata
CHANGED
@@ -1,194 +1,162 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specjour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0.rc1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sandro Turriate
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: dnssd
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
19
|
+
version: 2.0.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: thor
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 0.14.0
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.14.0
|
26
|
+
version: 2.0.1
|
46
27
|
- !ruby/object:Gem::Dependency
|
47
28
|
name: rspec
|
48
29
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
30
|
requirements:
|
51
31
|
- - '='
|
52
32
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2.
|
33
|
+
version: '2.13'
|
54
34
|
type: :development
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
37
|
requirements:
|
59
38
|
- - '='
|
60
39
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
40
|
+
version: '2.13'
|
62
41
|
- !ruby/object:Gem::Dependency
|
63
42
|
name: rr
|
64
43
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
44
|
requirements:
|
67
|
-
- -
|
45
|
+
- - ">="
|
68
46
|
- !ruby/object:Gem::Version
|
69
47
|
version: '0'
|
70
48
|
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - ">="
|
76
53
|
- !ruby/object:Gem::Version
|
77
54
|
version: '0'
|
78
55
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
56
|
+
name: yard
|
80
57
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
58
|
requirements:
|
83
|
-
- -
|
59
|
+
- - ">="
|
84
60
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
61
|
+
version: '0'
|
86
62
|
type: :development
|
87
63
|
prerelease: false
|
88
64
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
65
|
requirements:
|
91
|
-
- -
|
66
|
+
- - ">="
|
92
67
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
68
|
+
version: '0'
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
70
|
+
name: byebug
|
96
71
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
72
|
requirements:
|
99
|
-
- -
|
73
|
+
- - '='
|
100
74
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
75
|
+
version: 2.6.0
|
102
76
|
type: :development
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
79
|
requirements:
|
107
|
-
- -
|
80
|
+
- - '='
|
108
81
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
82
|
+
version: 2.6.0
|
110
83
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
84
|
+
name: fakefs
|
112
85
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
86
|
requirements:
|
115
|
-
- -
|
87
|
+
- - ">="
|
116
88
|
- !ruby/object:Gem::Version
|
117
89
|
version: '0'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
93
|
requirements:
|
123
|
-
- -
|
94
|
+
- - ">="
|
124
95
|
- !ruby/object:Gem::Version
|
125
96
|
version: '0'
|
126
|
-
description:
|
127
|
-
|
97
|
+
description: |2
|
98
|
+
Specjour splits your RSpec suite across multiple machines, and multiple
|
99
|
+
cores per machine, to run super-parallel-fast! Also works with Cucumber.
|
128
100
|
email: sandro.turriate@gmail.com
|
129
101
|
executables:
|
130
102
|
- specjour
|
131
103
|
extensions: []
|
132
104
|
extra_rdoc_files: []
|
133
105
|
files:
|
106
|
+
- History.markdown
|
107
|
+
- MIT_LICENSE
|
108
|
+
- README.markdown
|
109
|
+
- Rakefile
|
110
|
+
- bin/specjour
|
111
|
+
- lib/specjour.rb
|
134
112
|
- lib/specjour/cli.rb
|
113
|
+
- lib/specjour/colors.rb
|
135
114
|
- lib/specjour/configuration.rb
|
136
115
|
- lib/specjour/connection.rb
|
137
116
|
- lib/specjour/cpu.rb
|
138
|
-
- lib/specjour/cucumber/distributed_formatter.rb
|
139
|
-
- lib/specjour/cucumber/final_report.rb
|
140
|
-
- lib/specjour/cucumber/preloader.rb
|
141
|
-
- lib/specjour/cucumber/runner.rb
|
142
|
-
- lib/specjour/cucumber.rb
|
143
|
-
- lib/specjour/db_scrub.rb
|
144
|
-
- lib/specjour/dispatcher.rb
|
145
117
|
- lib/specjour/fork.rb
|
118
|
+
- lib/specjour/formatter.rb
|
119
|
+
- lib/specjour/listener.rb
|
146
120
|
- lib/specjour/loader.rb
|
147
|
-
- lib/specjour/
|
121
|
+
- lib/specjour/logger.rb
|
122
|
+
- lib/specjour/plugin.rb
|
123
|
+
- lib/specjour/plugin/base.rb
|
124
|
+
- lib/specjour/plugin/manager.rb
|
125
|
+
- lib/specjour/plugin/rails.rb
|
126
|
+
- lib/specjour/plugin/rails_v3.rb
|
127
|
+
- lib/specjour/plugin/rails_v4.rb
|
128
|
+
- lib/specjour/plugin/rspec.rb
|
129
|
+
- lib/specjour/plugin/rspec_v2.rb
|
130
|
+
- lib/specjour/plugin/rspec_v3.rb
|
131
|
+
- lib/specjour/plugin/ssh.rb
|
148
132
|
- lib/specjour/printer.rb
|
149
133
|
- lib/specjour/protocol.rb
|
150
|
-
- lib/specjour/
|
151
|
-
- lib/specjour/rspec/final_report.rb
|
152
|
-
- lib/specjour/rspec/marshalable_exception.rb
|
153
|
-
- lib/specjour/rspec/preloader.rb
|
154
|
-
- lib/specjour/rspec/runner.rb
|
155
|
-
- lib/specjour/rspec/shared_example_group_ext.rb
|
156
|
-
- lib/specjour/rspec.rb
|
134
|
+
- lib/specjour/rspec_formatter.rb
|
157
135
|
- lib/specjour/rsync_daemon.rb
|
158
136
|
- lib/specjour/socket_helper.rb
|
159
137
|
- lib/specjour/worker.rb
|
160
|
-
- lib/
|
161
|
-
- MIT_LICENSE
|
162
|
-
- README.markdown
|
163
|
-
- History.markdown
|
164
|
-
- Rakefile
|
165
|
-
- bin/specjour
|
138
|
+
- lib/specjour_plugin.rb
|
166
139
|
homepage: https://github.com/sandro/specjour
|
167
140
|
licenses: []
|
141
|
+
metadata: {}
|
168
142
|
post_install_message:
|
169
143
|
rdoc_options: []
|
170
144
|
require_paths:
|
171
145
|
- lib
|
172
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
-
none: false
|
174
147
|
requirements:
|
175
|
-
- -
|
148
|
+
- - ">="
|
176
149
|
- !ruby/object:Gem::Version
|
177
150
|
version: '0'
|
178
|
-
segments:
|
179
|
-
- 0
|
180
|
-
hash: -1349309289117832663
|
181
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
-
none: false
|
183
152
|
requirements:
|
184
|
-
- -
|
153
|
+
- - ">"
|
185
154
|
- !ruby/object:Gem::Version
|
186
|
-
version: 1.3.
|
155
|
+
version: 1.3.1
|
187
156
|
requirements: []
|
188
157
|
rubyforge_project:
|
189
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.4.5
|
190
159
|
signing_key:
|
191
|
-
specification_version:
|
160
|
+
specification_version: 4
|
192
161
|
summary: Distribute your spec suite amongst your LAN via Bonjour.
|
193
162
|
test_files: []
|
194
|
-
has_rdoc:
|
@@ -1,82 +0,0 @@
|
|
1
|
-
module Specjour::Cucumber
|
2
|
-
class DistributedFormatter < ::Cucumber::Formatter::Progress
|
3
|
-
|
4
|
-
def initialize(step_mother, io, options)
|
5
|
-
@step_mother = step_mother
|
6
|
-
@io = io
|
7
|
-
@options = options
|
8
|
-
@failing_scenarios = []
|
9
|
-
@step_summary = []
|
10
|
-
end
|
11
|
-
|
12
|
-
def after_features(features)
|
13
|
-
print_summary
|
14
|
-
step_mother.scenarios.clear
|
15
|
-
step_mother.steps.clear
|
16
|
-
end
|
17
|
-
|
18
|
-
def prepare_failures
|
19
|
-
step_mother.scenarios(:failed).select do |s|
|
20
|
-
s.is_a?(Cucumber::Ast::Scenario) || s.is_a?(Cucumber::Ast::OutlineTable::ExampleRow)
|
21
|
-
end.map do |failure|
|
22
|
-
if failure.is_a?(Cucumber::Ast::Scenario)
|
23
|
-
failure
|
24
|
-
elsif failure.is_a?(Cucumber::Ast::OutlineTable::ExampleRow)
|
25
|
-
failure.scenario_outline
|
26
|
-
end
|
27
|
-
end.each do |failure|
|
28
|
-
@failing_scenarios << format_string("cucumber " + failure.file_colon_line, :failed) +
|
29
|
-
format_string(" # Scenario: " + failure.name, :comment)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def prepare_elements(elements, status, kind)
|
34
|
-
output = ''
|
35
|
-
if elements.any?
|
36
|
-
output += format_string("\n(::) #{status} #{kind} (::)\n", status)
|
37
|
-
output += "\n"
|
38
|
-
end
|
39
|
-
|
40
|
-
elements.each_with_index do |element, i|
|
41
|
-
if status == :failed
|
42
|
-
output += print_exception(element.exception, status, 0)
|
43
|
-
else
|
44
|
-
output += format_string(element.backtrace_line, status)
|
45
|
-
output += "\n"
|
46
|
-
end
|
47
|
-
@step_summary << output unless output.nil? || output.empty?
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def prepare_steps(type)
|
52
|
-
prepare_elements(step_mother.steps(type), type, 'steps')
|
53
|
-
end
|
54
|
-
|
55
|
-
def print_exception(e, status, indent)
|
56
|
-
format_string("#{e.message} (#{e.class})\n#{e.backtrace.join("\n")}".indent(indent), status)
|
57
|
-
end
|
58
|
-
|
59
|
-
def print_summary
|
60
|
-
prepare_failures
|
61
|
-
prepare_steps(:failed)
|
62
|
-
prepare_steps(:undefined)
|
63
|
-
|
64
|
-
@io.send_message(:cucumber_summary=, to_hash)
|
65
|
-
end
|
66
|
-
|
67
|
-
OUTCOMES = [:failed, :skipped, :undefined, :pending, :passed]
|
68
|
-
|
69
|
-
def to_hash
|
70
|
-
hash = {}
|
71
|
-
[:scenarios, :steps].each do |type|
|
72
|
-
hash[type] = {}
|
73
|
-
OUTCOMES.each do |outcome|
|
74
|
-
hash[type][outcome] = step_mother.send(type, outcome).size
|
75
|
-
end
|
76
|
-
end
|
77
|
-
hash.merge!(:failing_scenarios => @failing_scenarios, :step_summary => @step_summary)
|
78
|
-
hash
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
module Specjour
|
2
|
-
module Cucumber
|
3
|
-
class Summarizer
|
4
|
-
attr_reader :duration, :failing_scenarios, :step_summary
|
5
|
-
def initialize
|
6
|
-
@duration = 0.0
|
7
|
-
@failing_scenarios = []
|
8
|
-
@step_summary = []
|
9
|
-
@scenarios = Hash.new(0)
|
10
|
-
@steps = Hash.new(0)
|
11
|
-
end
|
12
|
-
|
13
|
-
def increment(category, type, count)
|
14
|
-
current = instance_variable_get("@#{category}")
|
15
|
-
current[type] += count
|
16
|
-
end
|
17
|
-
|
18
|
-
def add(stats)
|
19
|
-
stats.each do |category, hash|
|
20
|
-
if category == :failing_scenarios
|
21
|
-
@failing_scenarios += hash
|
22
|
-
elsif category == :step_summary
|
23
|
-
@step_summary += hash
|
24
|
-
elsif category == :duration
|
25
|
-
@duration = hash.to_f if duration < hash.to_f
|
26
|
-
else
|
27
|
-
hash.each do |type, count|
|
28
|
-
increment(category, type, count)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def scenarios(status=nil)
|
35
|
-
length = status ? @scenarios[status] : @scenarios.inject(0) {|h,(k,v)| h += v}
|
36
|
-
any = @scenarios[status] > 0 if status
|
37
|
-
OpenStruct.new(:length => length , :any? => any)
|
38
|
-
end
|
39
|
-
|
40
|
-
def steps(status=nil)
|
41
|
-
length = status ? @steps[status] : @steps.inject(0) {|h,(k,v)| h += v}
|
42
|
-
any = @steps[status] > 0 if status
|
43
|
-
OpenStruct.new(:length => length , :any? => any)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class FinalReport
|
48
|
-
include ::Cucumber::Formatter::Console
|
49
|
-
def initialize
|
50
|
-
@io = $stdout
|
51
|
-
@features = []
|
52
|
-
@summarizer = Summarizer.new
|
53
|
-
end
|
54
|
-
|
55
|
-
def add(stats)
|
56
|
-
@summarizer.add(stats)
|
57
|
-
end
|
58
|
-
|
59
|
-
def exit_status
|
60
|
-
@summarizer.failing_scenarios.empty?
|
61
|
-
end
|
62
|
-
|
63
|
-
def summarize
|
64
|
-
if @summarizer.steps(:failed).any?
|
65
|
-
puts "\n\n"
|
66
|
-
@summarizer.step_summary.each {|f| puts f }
|
67
|
-
end
|
68
|
-
|
69
|
-
if @summarizer.failing_scenarios.any?
|
70
|
-
puts "\n\n"
|
71
|
-
puts format_string("Failing Scenarios:", :failed)
|
72
|
-
@summarizer.failing_scenarios.each {|f| puts f }
|
73
|
-
end
|
74
|
-
|
75
|
-
default_format = lambda {|status_count, status| format_string(status_count, status)}
|
76
|
-
puts
|
77
|
-
puts scenario_summary(@summarizer, &default_format)
|
78
|
-
puts step_summary(@summarizer, &default_format)
|
79
|
-
puts format_duration(@summarizer.duration) if @summarizer.duration
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Specjour
|
2
|
-
module Cucumber
|
3
|
-
module Preloader
|
4
|
-
def self.load(paths, output)
|
5
|
-
Specjour.benchmark("Loading Cucumber Environment") do
|
6
|
-
require 'cucumber' unless defined?(::Cucumber::Cli)
|
7
|
-
args = paths.unshift '--format', 'Specjour::Cucumber::DistributedFormatter'
|
8
|
-
cli = ::Cucumber::Cli::Main.new(args, output)
|
9
|
-
|
10
|
-
configuration = cli.configuration
|
11
|
-
options = configuration.instance_variable_get(:@options)
|
12
|
-
options.instance_variable_set(:@skip_profile_information, true)
|
13
|
-
|
14
|
-
runtime = ::Cucumber::Runtime.new(configuration)
|
15
|
-
runtime.send :load_step_definitions
|
16
|
-
runtime.send :fire_after_configuration_hook
|
17
|
-
Cucumber.runtime = runtime
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Specjour
|
2
|
-
module Cucumber
|
3
|
-
module Runner
|
4
|
-
def self.run(feature)
|
5
|
-
Cucumber.runtime.instance_eval do
|
6
|
-
@loader = nil
|
7
|
-
@configuration.parse!([feature])
|
8
|
-
tree_walker = @configuration.build_tree_walker(self)
|
9
|
-
self.visitor = tree_walker
|
10
|
-
tree_walker.visit_features features
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/specjour/cucumber.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Specjour
|
2
|
-
module Cucumber
|
3
|
-
begin
|
4
|
-
require 'cucumber/formatter/progress'
|
5
|
-
|
6
|
-
require 'specjour/cucumber/distributed_formatter'
|
7
|
-
require 'specjour/cucumber/final_report'
|
8
|
-
require 'specjour/cucumber/preloader'
|
9
|
-
require 'specjour/cucumber/runner'
|
10
|
-
rescue LoadError
|
11
|
-
end
|
12
|
-
|
13
|
-
class << self; attr_accessor :runtime; end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
data/lib/specjour/db_scrub.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Specjour
|
3
|
-
module DbScrub
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'rake'
|
7
|
-
extend Rake::DSL if defined?(Rake::DSL)
|
8
|
-
if defined?(Rails)
|
9
|
-
Rake::Task.define_task(:environment) { }
|
10
|
-
load 'rails/tasks/misc.rake'
|
11
|
-
load 'active_record/railties/databases.rake'
|
12
|
-
end
|
13
|
-
rescue LoadError
|
14
|
-
Specjour.logger.debug "Failed to load Rails rake tasks"
|
15
|
-
end
|
16
|
-
|
17
|
-
extend self
|
18
|
-
|
19
|
-
def drop
|
20
|
-
Rake::Task['db:drop'].invoke
|
21
|
-
end
|
22
|
-
|
23
|
-
def scrub
|
24
|
-
connect_to_database
|
25
|
-
puts "Resetting database #{ENV['TEST_ENV_NUMBER']}"
|
26
|
-
schema_load_task.invoke
|
27
|
-
end
|
28
|
-
|
29
|
-
protected
|
30
|
-
|
31
|
-
def connect_to_database
|
32
|
-
ActiveRecord::Base.remove_connection
|
33
|
-
ActiveRecord::Base.configurations = Rails.application.config.database_configuration
|
34
|
-
ActiveRecord::Base.establish_connection
|
35
|
-
connection
|
36
|
-
rescue # assume the database doesn't exist
|
37
|
-
Rake::Task['db:create'].invoke
|
38
|
-
end
|
39
|
-
|
40
|
-
def connection
|
41
|
-
ActiveRecord::Base.connection
|
42
|
-
end
|
43
|
-
|
44
|
-
def pending_migrations?
|
45
|
-
ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations.any?
|
46
|
-
end
|
47
|
-
|
48
|
-
def schema_load_task
|
49
|
-
Rake::Task[{ :sql => "db:test:load_structure", :ruby => "db:test:load" }[ActiveRecord::Base.schema_format]]
|
50
|
-
end
|
51
|
-
|
52
|
-
def tables_to_purge
|
53
|
-
connection.tables - ['schema_migrations']
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|