specjour 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +12 -1
- data/README.markdown +19 -5
- data/Rakefile +3 -35
- data/lib/specjour/cucumber/preloader.rb +0 -22
- data/lib/specjour/cucumber/runner.rb +5 -9
- data/lib/specjour/cucumber.rb +0 -1
- data/lib/specjour/db_scrub.rb +15 -10
- data/lib/specjour/printer.rb +1 -1
- data/lib/specjour/rspec/distributed_formatter.rb +32 -56
- data/lib/specjour/rspec/final_report.rb +60 -52
- data/lib/specjour/rspec/marshalable_exception.rb +1 -1
- data/lib/specjour/rspec/preloader.rb +1 -1
- data/lib/specjour/rspec/runner.rb +9 -8
- data/lib/specjour/{rspec2 → rspec}/shared_example_group_ext.rb +1 -1
- data/lib/specjour/rspec.rb +10 -29
- data/lib/specjour/socket_helper.rb +2 -0
- data/lib/specjour/worker.rb +2 -2
- data/lib/specjour.rb +3 -3
- metadata +24 -112
- data/.dev +0 -3
- data/.document +0 -5
- data/.gitignore +0 -25
- data/.rvmrc +0 -1
- data/Gemfile +0 -2
- data/VERSION +0 -1
- data/lib/specjour/rspec/marshalable_rspec_failure.rb +0 -21
- data/lib/specjour/rspec2/distributed_formatter.rb +0 -48
- data/lib/specjour/rspec2/final_report.rb +0 -73
- data/lib/specjour/rspec2/runner.rb +0 -12
- data/sample/features/fail.feature +0 -31
- data/sample/features/pass.feature +0 -31
- data/sample/features/step_definitions/sample_steps.rb +0 -26
- data/sample/features/undefined.feature +0 -17
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -20
- data/spec/specjour/cli_spec.rb +0 -105
- data/spec/specjour/configuration_spec.rb +0 -112
- data/spec/specjour/cpu_spec.rb +0 -28
- data/spec/specjour/manager_spec.rb +0 -21
- data/spec/specjour/printer_spec.rb +0 -101
- data/spec/specjour/rsync_daemon_spec.rb +0 -90
- data/spec/specjour_spec.rb +0 -18
- data/specjour.gemspec +0 -125
data/History.markdown
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
History
|
2
2
|
=======
|
3
3
|
|
4
|
+
0.4.0 / 2011-03-09
|
5
|
+
------------------
|
6
|
+
|
7
|
+
l4rk and leshill
|
8
|
+
|
9
|
+
* [added] Remove Jeweler
|
10
|
+
* [added] Use RSpec2 for development
|
11
|
+
* [added] Cucumber 0.9+ compatibility
|
12
|
+
* [added] RSpec2 compatibility
|
13
|
+
* [removed] No longer supporting RSpec 1 and Cucumber 0.8
|
14
|
+
|
4
15
|
0.3.1 / 2010-10-16
|
5
|
-
|
16
|
+
------------------
|
6
17
|
|
7
18
|
#### Fixes
|
8
19
|
* Stopping bonjour actually stops the currently running service
|
data/README.markdown
CHANGED
@@ -104,18 +104,32 @@ By default, the dispatcher looks for managers matching the project's directory n
|
|
104
104
|
|
105
105
|
## Compatibility
|
106
106
|
|
107
|
-
* RSpec
|
108
|
-
*
|
109
|
-
* Cucumber 0.8.5
|
110
|
-
* Cucumber 0.9.2
|
107
|
+
* RSpec 2
|
108
|
+
* Cucumber 0.9+
|
111
109
|
* Rails 2
|
112
110
|
* Rails 3
|
113
111
|
|
112
|
+
## Hacking on Specjour
|
113
|
+
If you want to hack on specjour, here is how to test your changes:
|
114
|
+
|
115
|
+
source .dev
|
116
|
+
rake # run the test suite sanely
|
117
|
+
specjour # run the test suite with specjour
|
118
|
+
cd sample
|
119
|
+
specjour # run the cucumber test suite with specjour
|
120
|
+
|
121
|
+
Then if all is good, go to another app and test your changes on your test suite:
|
122
|
+
|
123
|
+
gem build specjour.gemspec
|
124
|
+
cd /path/to/your/project
|
125
|
+
gem install -l /path/to/specjour/latest.gem
|
126
|
+
specjour
|
127
|
+
|
114
128
|
## Thanks
|
115
129
|
|
116
130
|
* shayarnett - Cucumber support, pairing and other various patches
|
117
131
|
* voxdolo - Endless support, alpha testing, various patches
|
118
|
-
* leshill -
|
132
|
+
* l4rk and leshill - Removed Jeweler, added support for RSpec 2 and Cucumber 0.9+
|
119
133
|
* testjour - Ripped off your name
|
120
134
|
* parallel\_tests - Made my test suite twice as fast
|
121
135
|
|
data/Rakefile
CHANGED
@@ -1,42 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "specjour"
|
8
|
-
gem.summary = %Q{Distribute your spec suite amongst your LAN via Bonjour.}
|
9
|
-
gem.description = %Q{Distribute your spec suite amongst your LAN via Bonjour.}
|
10
|
-
gem.email = "sandro.turriate@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/sandro/specjour"
|
12
|
-
gem.authors = ["Sandro Turriate"]
|
13
|
-
gem.add_dependency "dnssd", "1.3.4"
|
14
|
-
gem.add_dependency "thor", ">=0.14.0"
|
15
|
-
gem.add_development_dependency "rspec", "1.3.0"
|
16
|
-
gem.add_development_dependency "rr", ">=0.10.11"
|
17
|
-
gem.add_development_dependency "cucumber", ">=0.9.0"
|
18
|
-
gem.add_development_dependency "yard", ">=0.5.3"
|
19
|
-
gem.add_development_dependency "jeweler", ">=1.4.0"
|
20
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
21
|
-
end
|
22
|
-
Jeweler::GemcutterTasks.new
|
23
|
-
rescue LoadError
|
24
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
-
end
|
26
|
-
|
27
|
-
require 'spec/rake/spectask'
|
28
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
29
|
-
spec.libs << 'lib' << 'spec'
|
30
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
31
|
-
end
|
32
|
-
|
33
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
34
|
-
spec.libs << 'lib' << 'spec'
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
-
spec.rcov = true
|
37
|
-
end
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
38
6
|
|
39
|
-
|
7
|
+
RSpec::Core::RakeTask.new(:rcov)
|
40
8
|
|
41
9
|
task :default => :spec
|
42
10
|
|
@@ -2,28 +2,6 @@ module Specjour
|
|
2
2
|
module Cucumber
|
3
3
|
module Preloader
|
4
4
|
def self.load(feature_file)
|
5
|
-
if CUCUMBER_09x
|
6
|
-
load_09x
|
7
|
-
else
|
8
|
-
load_08x
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
protected
|
13
|
-
|
14
|
-
def self.load_08x
|
15
|
-
cli = ::Cucumber::Cli::Main.new []
|
16
|
-
step_mother = cli.class.step_mother
|
17
|
-
|
18
|
-
step_mother.log = cli.configuration.log
|
19
|
-
step_mother.options = cli.configuration.options
|
20
|
-
step_mother.load_code_files(cli.configuration.support_to_load)
|
21
|
-
step_mother.after_configuration(cli.configuration)
|
22
|
-
features = step_mother.load_plain_text_features(cli.configuration.feature_files)
|
23
|
-
step_mother.load_code_files(cli.configuration.step_defs_to_load)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.load_09x
|
27
5
|
configuration = ::Cucumber::Cli::Configuration.new
|
28
6
|
configuration.parse! []
|
29
7
|
runtime = ::Cucumber::Runtime.new(configuration)
|
@@ -4,15 +4,11 @@ module Specjour
|
|
4
4
|
def self.run(feature, output)
|
5
5
|
cli = ::Cucumber::Cli::Main.new(['--format', 'Specjour::Cucumber::DistributedFormatter', feature], output)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
tree_walker.visit_features(features)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
cli.execute!(::Cucumber::Cli::Main.step_mother)
|
7
|
+
Cucumber.runtime.instance_variable_set(:@configuration, cli.configuration)
|
8
|
+
Cucumber.runtime.instance_eval do
|
9
|
+
tree_walker = @configuration.build_tree_walker(self)
|
10
|
+
self.visitor = tree_walker
|
11
|
+
tree_walker.visit_features(features)
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
data/lib/specjour/cucumber.rb
CHANGED
data/lib/specjour/db_scrub.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
module Specjour
|
2
2
|
module DbScrub
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rake'
|
6
|
+
if defined?(Rails) && Rails.version =~ /^3/
|
7
|
+
task(:environment) {}
|
8
|
+
load 'rails/tasks/misc.rake'
|
9
|
+
load 'active_record/railties/databases.rake'
|
10
|
+
else
|
11
|
+
load 'tasks/misc.rake'
|
12
|
+
load 'tasks/databases.rake'
|
13
|
+
Rake::Task["db:structure:dump"].clear
|
14
|
+
Rake::Task["environment"].clear
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
Specjour.logger.debug "Failed to load Rails rake tasks"
|
13
18
|
end
|
14
19
|
|
15
20
|
extend self
|
data/lib/specjour/printer.rb
CHANGED
@@ -1,72 +1,48 @@
|
|
1
|
-
module Specjour::
|
2
|
-
class DistributedFormatter <
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def example_failed(example, counter, failure)
|
19
|
-
failing_messages << colorize_failure('F', failure)
|
20
|
-
print_and_flush(failing_messages)
|
21
|
-
end
|
22
|
-
|
23
|
-
def example_passed(example)
|
24
|
-
passing_messages << green('.')
|
25
|
-
print_and_flush(passing_messages)
|
1
|
+
module Specjour::RSpec
|
2
|
+
class DistributedFormatter < ::RSpec::Core::Formatters::ProgressFormatter
|
3
|
+
|
4
|
+
def metadata_for_examples
|
5
|
+
examples.map do |example|
|
6
|
+
metadata = example.metadata
|
7
|
+
{
|
8
|
+
:execution_result => marshalable_execution_result(example.execution_result),
|
9
|
+
:description => metadata[:description],
|
10
|
+
:file_path => metadata[:file_path],
|
11
|
+
:full_description => metadata[:full_description],
|
12
|
+
:line_number => metadata[:line_number],
|
13
|
+
:location => metadata[:location]
|
14
|
+
}
|
15
|
+
end
|
26
16
|
end
|
27
17
|
|
28
|
-
def
|
29
|
-
super
|
30
|
-
pending_messages << yellow('*')
|
31
|
-
print_and_flush(pending_messages)
|
18
|
+
def noop(*args)
|
32
19
|
end
|
20
|
+
alias dump_pending noop
|
21
|
+
alias dump_failures noop
|
22
|
+
alias start_dump noop
|
23
|
+
alias message noop
|
33
24
|
|
34
|
-
def
|
35
|
-
|
36
|
-
@example_count = example_count
|
37
|
-
@failure_count = failure_count
|
38
|
-
@pending_count = pending_count
|
39
|
-
output.send_message(:rspec_summary=, to_hash)
|
25
|
+
def color_enabled?
|
26
|
+
true
|
40
27
|
end
|
41
28
|
|
42
|
-
def
|
43
|
-
|
29
|
+
def dump_summary(*args)
|
30
|
+
output.send_message :rspec_summary=, metadata_for_examples
|
44
31
|
end
|
45
32
|
|
46
|
-
def
|
47
|
-
|
33
|
+
def close
|
34
|
+
@examples = []
|
35
|
+
super
|
48
36
|
end
|
49
37
|
|
50
|
-
|
51
|
-
print_and_flush failing_messages
|
52
|
-
print_and_flush passing_messages
|
53
|
-
print_and_flush pending_messages
|
54
|
-
end
|
38
|
+
protected
|
55
39
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
59
|
-
h[key] = send(key)
|
40
|
+
def marshalable_execution_result(execution_result)
|
41
|
+
if exception = execution_result[:exception]
|
42
|
+
execution_result[:exception] = MarshalableException.new(exception)
|
60
43
|
end
|
61
|
-
|
44
|
+
execution_result
|
62
45
|
end
|
63
46
|
|
64
|
-
protected
|
65
|
-
|
66
|
-
def print_and_flush(messages)
|
67
|
-
output.print messages.join
|
68
|
-
output.flush
|
69
|
-
messages.replace []
|
70
|
-
end
|
71
47
|
end
|
72
48
|
end
|
@@ -1,65 +1,73 @@
|
|
1
|
-
module Specjour
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Specjour::RSpec
|
2
|
+
class FinalReport
|
3
|
+
attr_reader :examples
|
4
|
+
attr_reader :duration
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@failing_examples = []
|
13
|
-
end
|
14
|
-
|
15
|
-
def add(stats)
|
16
|
-
stats.each do |key, value|
|
17
|
-
if key == :duration
|
18
|
-
@duration = value.to_f if duration < value.to_f
|
19
|
-
else
|
20
|
-
increment(key, value)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
6
|
+
def initialize
|
7
|
+
@examples = []
|
8
|
+
@duration = 0.0
|
9
|
+
::RSpec.configuration.color_enabled = true
|
10
|
+
::RSpec.configuration.output_stream = $stdout
|
11
|
+
end
|
24
12
|
|
25
|
-
|
26
|
-
|
13
|
+
def add(data)
|
14
|
+
if data.respond_to?(:has_key?) && data.has_key?(:duration)
|
15
|
+
self.duration = data[:duration]
|
16
|
+
else
|
17
|
+
metadata_for_examples(data)
|
27
18
|
end
|
19
|
+
end
|
28
20
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
21
|
+
def duration=(value)
|
22
|
+
@duration = value.to_f if duration < value.to_f
|
23
|
+
end
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
:autospec => false,
|
38
|
-
:dry_run => false
|
39
|
-
)
|
40
|
-
end
|
25
|
+
def exit_status
|
26
|
+
formatter.failed_examples.empty?
|
27
|
+
end
|
41
28
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
29
|
+
def metadata_for_examples(metadata_collection)
|
30
|
+
examples.concat(
|
31
|
+
metadata_collection.map do |partial_metadata|
|
32
|
+
example = ::RSpec::Core::Example.allocate
|
33
|
+
example.instance_variable_set(:@example_group_class,
|
34
|
+
OpenStruct.new(:metadata => {}, :ancestors => [])
|
35
|
+
)
|
36
|
+
metadata = ::RSpec::Core::Metadata.new
|
37
|
+
metadata.merge! partial_metadata
|
38
|
+
example.instance_variable_set(:@metadata, metadata)
|
39
|
+
example
|
47
40
|
end
|
48
|
-
|
41
|
+
)
|
42
|
+
end
|
49
43
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
dump_failures
|
54
|
-
formatter.dump_summary(duration, example_count, failure_count, pending_count)
|
55
|
-
end
|
56
|
-
end
|
44
|
+
def pending_examples
|
45
|
+
::RSpec.world.find(examples, :execution_result => { :status => 'pending' })
|
46
|
+
end
|
57
47
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
48
|
+
def failed_examples
|
49
|
+
::RSpec.world.find(examples, :execution_result => { :status => 'failed' })
|
50
|
+
end
|
51
|
+
|
52
|
+
def formatter
|
53
|
+
@formatter ||= new_progress_formatter
|
54
|
+
end
|
55
|
+
|
56
|
+
def summarize
|
57
|
+
if examples.size > 0
|
58
|
+
formatter.start_dump
|
59
|
+
formatter.dump_pending
|
60
|
+
formatter.dump_failures
|
61
|
+
formatter.dump_summary(duration, examples.size, failed_examples.size, pending_examples.size)
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
def new_progress_formatter
|
67
|
+
new_formatter = ::RSpec::Core::Formatters::ProgressFormatter.new($stdout)
|
68
|
+
new_formatter.instance_variable_set(:@failed_examples, failed_examples)
|
69
|
+
new_formatter.instance_variable_set(:@pending_examples, pending_examples)
|
70
|
+
new_formatter
|
71
|
+
end
|
64
72
|
end
|
65
73
|
end
|
@@ -1,11 +1,12 @@
|
|
1
|
-
module Specjour::
|
1
|
+
module Specjour::RSpec::Runner
|
2
2
|
def self.run(spec, output)
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
reset
|
4
|
+
args = ['--format=Specjour::RSpec::DistributedFormatter', spec]
|
5
|
+
::RSpec::Core::Runner.run_in_process args, $stderr, output
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.reset
|
9
|
+
::RSpec.world.instance_variable_set(:@example_groups, [])
|
10
|
+
::RSpec.configuration.instance_variable_set(:@formatter, nil)
|
10
11
|
end
|
11
12
|
end
|
data/lib/specjour/rspec.rb
CHANGED
@@ -1,35 +1,16 @@
|
|
1
1
|
module Specjour
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec/runner/formatter/base_text_formatter'
|
2
|
+
module RSpec
|
3
|
+
require 'rspec/core'
|
4
|
+
require 'rspec/core/formatters/progress_formatter'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.load_rspec2
|
15
|
-
require 'rspec/core'
|
16
|
-
require 'rspec/core/formatters/progress_formatter'
|
17
|
-
|
18
|
-
require 'specjour/rspec/marshalable_exception'
|
19
|
-
require 'specjour/rspec/preloader'
|
20
|
-
require 'specjour/rspec2/distributed_formatter'
|
21
|
-
require 'specjour/rspec2/final_report'
|
22
|
-
require 'specjour/rspec2/runner'
|
23
|
-
require 'specjour/rspec2/shared_example_group_ext'
|
6
|
+
require 'specjour/rspec/marshalable_exception'
|
7
|
+
require 'specjour/rspec/preloader'
|
8
|
+
require 'specjour/rspec/distributed_formatter'
|
9
|
+
require 'specjour/rspec/final_report'
|
10
|
+
require 'specjour/rspec/runner'
|
11
|
+
require 'specjour/rspec/shared_example_group_ext'
|
24
12
|
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
begin
|
29
|
-
load_rspec2
|
30
|
-
rescue LoadError
|
31
|
-
load_rspec1
|
32
|
-
end
|
13
|
+
::RSpec::Core::Runner.disable_autorun!
|
33
14
|
|
34
15
|
def self.wants_to_quit
|
35
16
|
if defined?(::RSpec) && ::RSpec.respond_to?(:wants_to_quit=)
|
data/lib/specjour/worker.rb
CHANGED
@@ -60,7 +60,7 @@ module Specjour
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def load_app
|
63
|
-
|
63
|
+
RSpec::Preloader.load(preload_spec) if preload_spec
|
64
64
|
Cucumber::Preloader.load(preload_feature) if preload_feature
|
65
65
|
rescue StandardError => exception
|
66
66
|
$stderr.puts "Caught exception: #{exception.class} #{exception.message}"
|
@@ -100,7 +100,7 @@ module Specjour
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def run_spec(spec)
|
103
|
-
Specjour::
|
103
|
+
Specjour::RSpec::Runner.run(spec, connection)
|
104
104
|
end
|
105
105
|
|
106
106
|
def send_run_times(run_times)
|
data/lib/specjour.rb
CHANGED
@@ -26,9 +26,9 @@ module Specjour
|
|
26
26
|
autoload :Worker, 'specjour/worker'
|
27
27
|
|
28
28
|
autoload :Cucumber, 'specjour/cucumber'
|
29
|
-
autoload :
|
29
|
+
autoload :RSpec, 'specjour/rspec'
|
30
30
|
|
31
|
-
VERSION = "0.
|
31
|
+
VERSION = "0.4.0"
|
32
32
|
HOOKS_PATH = "./.specjour/hooks.rb"
|
33
33
|
|
34
34
|
def self.interrupted?
|
@@ -37,7 +37,7 @@ module Specjour
|
|
37
37
|
|
38
38
|
def self.interrupted=(bool)
|
39
39
|
Cucumber.wants_to_quit
|
40
|
-
|
40
|
+
RSpec.wants_to_quit
|
41
41
|
@interrupted = bool
|
42
42
|
end
|
43
43
|
|