deep_test 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.2.2 (October 11, 2008)
2
+
3
+ * Added libs option to DeepTest::TestTask for Rails 2.1 compatibility
4
+ * RSpec 1.1.8 compatibility
5
+ * Require RSpec 1.1.8
6
+
1
7
  1.2.1 (September 25, 2008)
2
8
 
3
9
  * rspec 1.1.4 compatibility
@@ -19,6 +19,7 @@ In your Rakefile:
19
19
  t.timeout_in_seconds = 30 # optional, defaults to 30
20
20
  t.server_port = 6969 # optional, defaults to 6969
21
21
  t.pattern = "test/**/*_test.rb"
22
+ t.libs << "test" # may be necessary for Rails >= 2.1.x
22
23
  end
23
24
 
24
25
  # sample SpecTask using DeepTest
data/Rakefile CHANGED
@@ -19,6 +19,8 @@ task :default => %w[
19
19
  test_rails_project
20
20
  ]
21
21
 
22
+ task :pc => :default
23
+
22
24
  Rake::TestTask.new do |t|
23
25
  t.pattern = "test/**/*_test.rb"
24
26
  t.libs += ['test', 'lib']
@@ -182,7 +184,7 @@ specification = Gem::Specification.new do |s|
182
184
  s.platform = Gem::Platform::RUBY
183
185
  s.name = "deep_test"
184
186
  s.summary = "DeepTest runs tests in multiple processes."
185
- s.version = "1.2.1"
187
+ s.version = "1.2.2"
186
188
  s.author = "anonymous z, Dan Manges, David Vollbracht"
187
189
  s.description = s.summary
188
190
  s.email = "daniel.manges@gmail.com"
@@ -5,15 +5,15 @@ module DeepTest
5
5
  # requiring 'spec' directly blows up unit-record
6
6
  require "spec/version"
7
7
  if defined?(::Spec)
8
- if ::Spec::VERSION::MAJOR >= 1 &&
9
- ::Spec::VERSION::MINOR >= 1 &&
10
- ::Spec::VERSION::TINY >= 4
8
+ if ::Spec::VERSION::MAJOR == 1 &&
9
+ ::Spec::VERSION::MINOR == 1 &&
10
+ ::Spec::VERSION::TINY == 8
11
11
  yield
12
12
  else
13
13
  require 'spec/rake/spectask'
14
14
  ::Spec::Rake::SpecTask.class_eval do
15
15
  def deep_test(options)
16
- raise "* DeepTest RSpec support requires RSpec 1.1.4 or greater"
16
+ raise "* DeepTest RSpec support requires RSpec 1.1.8"
17
17
  end
18
18
  end
19
19
  end
@@ -8,14 +8,15 @@ module DeepTest
8
8
  def run
9
9
  # Dup options here to avoid clobbering the reporter on someone
10
10
  # elses options reference (Such as ExampleGroupRunner)
11
- original_options, $rspec_options = $rspec_options, $rspec_options.dup
12
- rspec_options.reporter = ResultReporter.new(@identifier)
11
+ original_options = ::Spec::Runner.options
12
+ ::Spec::Runner.use ::Spec::Runner.options.dup
13
+ ::Spec::Runner.options.reporter = ResultReporter.new(@identifier)
13
14
  result = run_without_deadlock_protection
14
15
  result = run_without_deadlock_protection if result.failed_due_to_deadlock?
15
16
  result = result.deadlock_result if result.failed_due_to_deadlock?
16
17
  result
17
18
  ensure
18
- $rspec_options = original_options
19
+ ::Spec::Runner.use original_options
19
20
  end
20
21
 
21
22
  def to_s
@@ -26,9 +27,9 @@ module DeepTest
26
27
 
27
28
  def run_without_deadlock_protection
28
29
  output = capture_stdout do
29
- rspec_options.run_one_example(@identifier)
30
+ ::Spec::Runner.options.run_one_example(@identifier)
30
31
  end
31
- rspec_options.reporter.result(output)
32
+ ::Spec::Runner.options.reporter.result(output)
32
33
  end
33
34
 
34
35
  class ResultReporter
@@ -1,10 +1,11 @@
1
1
  module DeepTest
2
2
  class TestTask
3
- attr_accessor :requires
3
+ attr_accessor :libs, :requires
4
4
 
5
5
  def initialize(name = :deep_test)
6
6
  @requires = []
7
7
  @name = name
8
+ @libs = ["lib"]
8
9
  @options = Options.new({})
9
10
  self.pattern = "test/**/*_test.rb"
10
11
  yield self if block_given?
@@ -14,8 +15,9 @@ module DeepTest
14
15
  def define
15
16
  desc "Run '#{@name}' suite using DeepTest"
16
17
  task @name do
18
+ lib_options = @libs.any? ? "-I" + @libs.join(File::PATH_SEPARATOR) : ""
17
19
  require_options = requires.map {|f| "-r#{f}"}.join(" ")
18
- ruby "#{require_options} #{runner} '#{@options.to_command_line}'"
20
+ ruby "#{lib_options} #{require_options} #{runner} '#{@options.to_command_line}'"
19
21
  end
20
22
  end
21
23
 
@@ -24,6 +24,37 @@ unit_tests do
24
24
  assert_equal "test/**/*_test.rb", task.pattern[-"test/**/*_test.rb".size..-1]
25
25
  end
26
26
 
27
+ test "default libs is ['lib']" do
28
+ task = DeepTest::TestTask.new do |t|
29
+ t.stubs(:define)
30
+ end
31
+ assert_equal ["lib"], task.libs
32
+ end
33
+
34
+ test "can add to libs" do
35
+ task = DeepTest::TestTask.new do |t|
36
+ t.libs << "test"
37
+ t.stubs(:define)
38
+ end
39
+ assert_equal ["lib", "test"], task.libs
40
+ end
41
+
42
+ test "define passes the -I option to the call to ruby" do
43
+ task = DeepTest::TestTask.new do |t|
44
+ t.libs << "test"
45
+ end
46
+ task.expects(:ruby).with(includes("-Ilib:test"))
47
+ Rake::Task["deep_test"].instance_variable_get("@actions").last.call
48
+ end
49
+
50
+ test "define does not pass the -I option to the call to ruby if there are no directories to add to the load path" do
51
+ task = DeepTest::TestTask.new do |t|
52
+ t.libs = []
53
+ end
54
+ task.expects(:ruby).with(Not(includes("-I")))
55
+ Rake::Task["deep_test"].instance_variable_get("@actions").last.call
56
+ end
57
+
27
58
  test "number_of_workers defaults to 2" do
28
59
  task = DeepTest::TestTask.new do |t|
29
60
  t.stubs(:define)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - anonymous z, Dan Manges, David Vollbracht
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-25 00:00:00 -05:00
12
+ date: 2008-10-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15