specjour 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/History.markdown +12 -1
  2. data/README.markdown +19 -5
  3. data/Rakefile +3 -35
  4. data/lib/specjour/cucumber/preloader.rb +0 -22
  5. data/lib/specjour/cucumber/runner.rb +5 -9
  6. data/lib/specjour/cucumber.rb +0 -1
  7. data/lib/specjour/db_scrub.rb +15 -10
  8. data/lib/specjour/printer.rb +1 -1
  9. data/lib/specjour/rspec/distributed_formatter.rb +32 -56
  10. data/lib/specjour/rspec/final_report.rb +60 -52
  11. data/lib/specjour/rspec/marshalable_exception.rb +1 -1
  12. data/lib/specjour/rspec/preloader.rb +1 -1
  13. data/lib/specjour/rspec/runner.rb +9 -8
  14. data/lib/specjour/{rspec2 → rspec}/shared_example_group_ext.rb +1 -1
  15. data/lib/specjour/rspec.rb +10 -29
  16. data/lib/specjour/socket_helper.rb +2 -0
  17. data/lib/specjour/worker.rb +2 -2
  18. data/lib/specjour.rb +3 -3
  19. metadata +24 -112
  20. data/.dev +0 -3
  21. data/.document +0 -5
  22. data/.gitignore +0 -25
  23. data/.rvmrc +0 -1
  24. data/Gemfile +0 -2
  25. data/VERSION +0 -1
  26. data/lib/specjour/rspec/marshalable_rspec_failure.rb +0 -21
  27. data/lib/specjour/rspec2/distributed_formatter.rb +0 -48
  28. data/lib/specjour/rspec2/final_report.rb +0 -73
  29. data/lib/specjour/rspec2/runner.rb +0 -12
  30. data/sample/features/fail.feature +0 -31
  31. data/sample/features/pass.feature +0 -31
  32. data/sample/features/step_definitions/sample_steps.rb +0 -26
  33. data/sample/features/undefined.feature +0 -17
  34. data/spec/spec.opts +0 -2
  35. data/spec/spec_helper.rb +0 -20
  36. data/spec/specjour/cli_spec.rb +0 -105
  37. data/spec/specjour/configuration_spec.rb +0 -112
  38. data/spec/specjour/cpu_spec.rb +0 -28
  39. data/spec/specjour/manager_spec.rb +0 -21
  40. data/spec/specjour/printer_spec.rb +0 -101
  41. data/spec/specjour/rsync_daemon_spec.rb +0 -90
  42. data/spec/specjour_spec.rb +0 -18
  43. data/specjour.gemspec +0 -125
@@ -1,112 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module RailsAndActiveRecordDefined
4
- def self.extended(base)
5
- base.class_eval do
6
- before do
7
- Object.const_set(:Rails, Module.new)
8
- Object.const_set(:ActiveRecord, Module.new)
9
- ActiveRecord.const_set(:Base, Class.new)
10
- end
11
-
12
- after do
13
- Object.send(:remove_const, :ActiveRecord)
14
- Object.send(:remove_const, :Rails)
15
- end
16
- end
17
- end
18
- end
19
-
20
- describe Specjour::Configuration do
21
- subject do
22
- Specjour::Configuration
23
- end
24
-
25
- before { subject.reset }
26
-
27
- describe "#before_fork" do
28
- context "default proc" do
29
- context "ActiveRecord defined" do
30
- extend RailsAndActiveRecordDefined
31
- it "disconnects from the database" do
32
- mock(ActiveRecord::Base).remove_connection
33
- subject.before_fork.call
34
- end
35
- end
36
-
37
- context "bundler installed" do
38
- before do
39
- mock(subject).system("which bundle") { true }
40
- end
41
-
42
- context "when gems not satisfied" do
43
- before do
44
- mock(subject).system("bundle check") { false }
45
- end
46
-
47
- it "runs 'bundle install'" do
48
- mock(subject).system('bundle install')
49
- subject.before_fork.call
50
- end
51
- end
52
-
53
- context "when gems are satisfied" do
54
- before do
55
- mock(subject).system("bundle check") { true }
56
- end
57
-
58
- it "doesn't run 'bundle install'" do
59
- dont_allow(subject).system('bundle install')
60
- subject.before_fork.call
61
- end
62
- end
63
- end
64
- end
65
-
66
- context "custom proc" do
67
- it "runs block" do
68
- subject.before_fork = lambda { :custom_before }
69
- subject.before_fork.call.should == :custom_before
70
- end
71
- end
72
- end
73
-
74
- describe "#after_fork" do
75
- it "defaults to nothing" do
76
- subject.after_fork.call.should be_nil
77
- end
78
-
79
- it "runs the block" do
80
- subject.after_fork = lambda { :custom_after }
81
- subject.after_fork.call.should == :custom_after
82
- end
83
-
84
- context "ActiveRecord defined" do
85
- extend RailsAndActiveRecordDefined
86
- it "scrubs the db" do
87
- mock(Specjour::DbScrub).scrub
88
- subject.after_fork.call
89
- end
90
- end
91
- end
92
-
93
- describe "#prepare" do
94
- it "defaults to nothing" do
95
- subject.prepare.call.should be_nil
96
- end
97
-
98
- it "runs the block" do
99
- subject.prepare = lambda { :custom_preparation }
100
- subject.prepare.call.should == :custom_preparation
101
- end
102
-
103
- context "ActiveRecord defined" do
104
- extend RailsAndActiveRecordDefined
105
- it "drops then scrubs the db" do
106
- mock(Specjour::DbScrub).drop
107
- mock(Specjour::DbScrub).scrub
108
- subject.prepare.call
109
- end
110
- end
111
- end
112
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Specjour::CPU do
4
- context "on a Mac" do
5
- let(:hostinfo) do
6
- %(
7
- Mach kernel version:
8
- Darwin Kernel Version 10.2.0: Tue Nov 3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386
9
- Kernel configured for up to 2 processors.
10
- 440 processors are physically available.
11
- 220 processors are logically available.
12
- Processor type: i486 (Intel 80486)
13
- Processors active: 0 1
14
- Primary memory available: 4.00 gigabytes
15
- Default processor set: 72 tasks, 310 threads, 2 processors
16
- Load average: 0.09, Mach factor: 1.90
17
- )
18
- end
19
-
20
- before do
21
- stub(Specjour::CPU).command.returns(hostinfo)
22
- end
23
-
24
- it "returns the number of physically available processors" do
25
- Specjour::CPU.cores.should == 440
26
- end
27
- end
28
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Specjour::Manager do
4
- describe "#available_for?" do
5
- subject { Specjour::Manager.new }
6
- it "isn't available for all projects by default" do
7
- subject.available_for?(rand.to_s).should be_false
8
- end
9
-
10
- it "is available for one project" do
11
- manager = Specjour::Manager.new :registered_projects => %w(one)
12
- manager.available_for?('one').should be_true
13
- end
14
-
15
- it "is available for many projects" do
16
- manager = Specjour::Manager.new :registered_projects => %w(one two)
17
- manager.available_for?('one').should be_true
18
- manager.available_for?('two').should be_true
19
- end
20
- end
21
- end
@@ -1,101 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Specjour::Printer do
4
- subject do
5
- Specjour::Printer.new []
6
- end
7
-
8
- describe "#exit_status" do
9
- let(:rspec_report) { Object.new }
10
- let(:cucumber_report) { Object.new }
11
-
12
- context "when cucumber_report is nil" do
13
- context "and rspec_report has true exit status" do
14
- before do
15
- stub(rspec_report).exit_status { true }
16
- subject.instance_variable_set(:@rspec_report, rspec_report)
17
- end
18
-
19
- it "has a true exit status" do
20
- subject.exit_status.should be_true
21
- end
22
- end
23
-
24
- context "and rspec_report has false exit status" do
25
- before do
26
- stub(rspec_report).exit_status { false }
27
- subject.instance_variable_set(:@rspec_report, rspec_report)
28
- end
29
-
30
- it "has a true exit status" do
31
- subject.exit_status.should be_false
32
- end
33
- end
34
- end
35
-
36
- context "when rspec report is nil" do
37
- context "and cucumber_report has true exit status" do
38
- before do
39
- stub(cucumber_report).exit_status { true }
40
- subject.instance_variable_set(:@cucumber_report, cucumber_report)
41
- end
42
-
43
- it "has a true exit status" do
44
- subject.exit_status.should be_true
45
- end
46
- end
47
-
48
- context "and cucumber_report has false exit status" do
49
- before do
50
- stub(cucumber_report).exit_status { false }
51
- subject.instance_variable_set(:@cucumber_report, cucumber_report)
52
- end
53
-
54
- it "has a true exit status" do
55
- subject.exit_status.should be_false
56
- end
57
- end
58
- end
59
-
60
- context "when both rspec and cucumber reports exists" do
61
- context "and rspec exit status is false" do
62
- before do
63
- stub(rspec_report).exit_status { false }
64
- stub(cucumber_report).exit_status { true }
65
- subject.instance_variable_set(:@cucumber_report, cucumber_report)
66
- subject.instance_variable_set(:@rspec_report, rspec_report)
67
- end
68
-
69
- it "returns false" do
70
- subject.exit_status.should be_false
71
- end
72
- end
73
-
74
- context "and cucumber exit status is false" do
75
- before do
76
- stub(rspec_report).exit_status { true }
77
- stub(cucumber_report).exit_status { false }
78
- subject.instance_variable_set(:@cucumber_report, cucumber_report)
79
- subject.instance_variable_set(:@rspec_report, rspec_report)
80
- end
81
-
82
- it "returns false" do
83
- subject.exit_status.should be_false
84
- end
85
- end
86
-
87
- context "both cucumber and rspec exit status are true" do
88
- before do
89
- stub(rspec_report).exit_status { true }
90
- stub(cucumber_report).exit_status { true }
91
- subject.instance_variable_set(:@cucumber_report, cucumber_report)
92
- subject.instance_variable_set(:@rspec_report, rspec_report)
93
- end
94
-
95
- it "returns false" do
96
- subject.exit_status.should be_true
97
- end
98
- end
99
- end
100
- end
101
- end
@@ -1,90 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Specjour::RsyncDaemon do
4
- subject do
5
- Specjour::RsyncDaemon.new('/tmp/seasonal', 'seasonal')
6
- end
7
-
8
- before do
9
- stub(Kernel).system
10
- stub(Kernel).at_exit
11
- stub(Dir).chdir
12
- stub(File).open
13
- stub(File).read
14
- stub(FileUtils).rm
15
- stub(Process).kill
16
- end
17
-
18
- specify { subject.config_directory.should == '/tmp/seasonal/.specjour' }
19
- specify { subject.config_file.should == '/tmp/seasonal/.specjour/rsyncd.conf' }
20
-
21
- describe "#start" do
22
- it "writes the config" do
23
- mock(subject).write_config
24
- subject.start
25
- end
26
-
27
- it "executes the system command in the project directory" do
28
- mock(Kernel).system(*subject.send(:command))
29
- mock(Dir).chdir(subject.project_path).yields
30
- subject.start
31
- end
32
-
33
- it "stops at_exit" do
34
- mock(subject).stop
35
- mock.proxy(Kernel).at_exit.yields(subject)
36
- subject.start
37
- end
38
- end
39
-
40
- describe "#stop" do
41
- context "with pid" do
42
- before do
43
- stub(subject).pid.returns(100_000_000)
44
- stub(Process).kill
45
- stub(FileUtils).rm
46
- end
47
-
48
- it "kills the pid with TERM" do
49
- mock(Process).kill('TERM', subject.pid)
50
- subject.stop
51
- end
52
-
53
- it "removes the pid file" do
54
- mock(FileUtils).rm(subject.pid_file)
55
- subject.stop
56
- end
57
- end
58
-
59
- context "without pid" do
60
- it "does nothing" do
61
- stub(subject).pid
62
- subject.stop.should be_nil
63
- end
64
- end
65
- end
66
-
67
- describe "#check_config_version" do
68
- it "warns when the version is out of date" do
69
- stub(File).read { "# 0.0.0\n" }
70
- mock($stderr).puts(/made changes/)
71
- subject.send(:check_config_version)
72
- end
73
-
74
- it "doesn't warn when the version isn't out of date" do
75
- stub(File).read { "# #{Specjour::RsyncDaemon::CONFIG_VERSION}\n" }
76
- dont_allow($stderr).puts
77
- subject.send(:check_config_version)
78
- end
79
- end
80
-
81
- describe "#write_config" do
82
- context "config exists" do
83
- it "checks if the config is out of date" do
84
- stub(File).exists?(anything) { true }
85
- mock(subject).check_config_version
86
- subject.send(:write_config)
87
- end
88
- end
89
- end
90
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class CustomException < RuntimeError
4
- end
5
-
6
- def boo
7
- raise CustomException, 'fails'
8
- end
9
-
10
- describe Specjour do
11
- it "pends as an example" do
12
- pending
13
- end
14
-
15
- it "fails as an example" do
16
- boo
17
- end
18
- end
data/specjour.gemspec DELETED
@@ -1,125 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{specjour}
8
- s.version = "0.3.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Sandro Turriate"]
12
- s.date = %q{2010-10-16}
13
- s.default_executable = %q{specjour}
14
- s.description = %q{Distribute your spec suite amongst your LAN via Bonjour.}
15
- s.email = %q{sandro.turriate@gmail.com}
16
- s.executables = ["specjour"]
17
- s.extra_rdoc_files = [
18
- "README.markdown"
19
- ]
20
- s.files = [
21
- ".dev",
22
- ".document",
23
- ".gitignore",
24
- ".rvmrc",
25
- "Gemfile",
26
- "History.markdown",
27
- "MIT_LICENSE",
28
- "README.markdown",
29
- "Rakefile",
30
- "VERSION",
31
- "bin/specjour",
32
- "lib/specjour.rb",
33
- "lib/specjour/cli.rb",
34
- "lib/specjour/configuration.rb",
35
- "lib/specjour/connection.rb",
36
- "lib/specjour/cpu.rb",
37
- "lib/specjour/cucumber.rb",
38
- "lib/specjour/cucumber/distributed_formatter.rb",
39
- "lib/specjour/cucumber/final_report.rb",
40
- "lib/specjour/cucumber/main_ext.rb",
41
- "lib/specjour/cucumber/preloader.rb",
42
- "lib/specjour/cucumber/runner.rb",
43
- "lib/specjour/db_scrub.rb",
44
- "lib/specjour/dispatcher.rb",
45
- "lib/specjour/manager.rb",
46
- "lib/specjour/printer.rb",
47
- "lib/specjour/protocol.rb",
48
- "lib/specjour/quiet_fork.rb",
49
- "lib/specjour/rspec.rb",
50
- "lib/specjour/rspec/distributed_formatter.rb",
51
- "lib/specjour/rspec/final_report.rb",
52
- "lib/specjour/rspec/marshalable_exception.rb",
53
- "lib/specjour/rspec/marshalable_rspec_failure.rb",
54
- "lib/specjour/rspec/preloader.rb",
55
- "lib/specjour/rspec/runner.rb",
56
- "lib/specjour/rspec2/distributed_formatter.rb",
57
- "lib/specjour/rspec2/final_report.rb",
58
- "lib/specjour/rspec2/runner.rb",
59
- "lib/specjour/rspec2/shared_example_group_ext.rb",
60
- "lib/specjour/rsync_daemon.rb",
61
- "lib/specjour/socket_helper.rb",
62
- "lib/specjour/worker.rb",
63
- "sample/features/fail.feature",
64
- "sample/features/pass.feature",
65
- "sample/features/step_definitions/sample_steps.rb",
66
- "sample/features/undefined.feature",
67
- "spec/spec.opts",
68
- "spec/spec_helper.rb",
69
- "spec/specjour/cli_spec.rb",
70
- "spec/specjour/configuration_spec.rb",
71
- "spec/specjour/cpu_spec.rb",
72
- "spec/specjour/manager_spec.rb",
73
- "spec/specjour/printer_spec.rb",
74
- "spec/specjour/rsync_daemon_spec.rb",
75
- "spec/specjour_spec.rb",
76
- "specjour.gemspec"
77
- ]
78
- s.homepage = %q{http://github.com/sandro/specjour}
79
- s.rdoc_options = ["--charset=UTF-8"]
80
- s.require_paths = ["lib"]
81
- s.rubygems_version = %q{1.3.7}
82
- s.summary = %q{Distribute your spec suite amongst your LAN via Bonjour.}
83
- s.test_files = [
84
- "spec/spec_helper.rb",
85
- "spec/specjour/cli_spec.rb",
86
- "spec/specjour/configuration_spec.rb",
87
- "spec/specjour/cpu_spec.rb",
88
- "spec/specjour/manager_spec.rb",
89
- "spec/specjour/printer_spec.rb",
90
- "spec/specjour/rsync_daemon_spec.rb",
91
- "spec/specjour_spec.rb"
92
- ]
93
-
94
- if s.respond_to? :specification_version then
95
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
96
- s.specification_version = 3
97
-
98
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
99
- s.add_runtime_dependency(%q<dnssd>, ["= 1.3.4"])
100
- s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
101
- s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
102
- s.add_development_dependency(%q<rr>, [">= 0.10.11"])
103
- s.add_development_dependency(%q<cucumber>, [">= 0.9.0"])
104
- s.add_development_dependency(%q<yard>, [">= 0.5.3"])
105
- s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
106
- else
107
- s.add_dependency(%q<dnssd>, ["= 1.3.4"])
108
- s.add_dependency(%q<thor>, [">= 0.14.0"])
109
- s.add_dependency(%q<rspec>, ["= 1.3.0"])
110
- s.add_dependency(%q<rr>, [">= 0.10.11"])
111
- s.add_dependency(%q<cucumber>, [">= 0.9.0"])
112
- s.add_dependency(%q<yard>, [">= 0.5.3"])
113
- s.add_dependency(%q<jeweler>, [">= 1.4.0"])
114
- end
115
- else
116
- s.add_dependency(%q<dnssd>, ["= 1.3.4"])
117
- s.add_dependency(%q<thor>, [">= 0.14.0"])
118
- s.add_dependency(%q<rspec>, ["= 1.3.0"])
119
- s.add_dependency(%q<rr>, [">= 0.10.11"])
120
- s.add_dependency(%q<cucumber>, [">= 0.9.0"])
121
- s.add_dependency(%q<yard>, [">= 0.5.3"])
122
- s.add_dependency(%q<jeweler>, [">= 1.4.0"])
123
- end
124
- end
125
-