nestor 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/TODO ADDED
@@ -0,0 +1 @@
1
+ * Handle test/fixtures in Rails::Test::Unit
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -25,10 +25,11 @@ def sendoff(timeout=0.8, path="tmp/nestor-sendoff") #:nodoc:
25
25
  end
26
26
  end
27
27
 
28
- def changed!(filename) #:nodoc:
28
+ def changed!(filename, should_sendoff=true) #:nodoc:
29
29
  return if File.directory?(filename)
30
+ log "Detected change on #{filename.inspect}"
30
31
  @machine.changed! filename
31
- sendoff
32
+ sendoff if should_sendoff
32
33
  end
33
34
 
34
35
  watch 'config/(?:.+)\.(?:rb|ya?ml)' do |md|
@@ -46,7 +47,7 @@ end
46
47
  watch 'db/schema.rb' do |md|
47
48
  log "Detected changed schema: preparing test DB"
48
49
  system("rake db:test:prepare")
49
- changed! md[0]
50
+ changed! md[0], false
50
51
  end
51
52
 
52
53
  # This is only to trigger the tests after a slight delay, but from the main thread.
@@ -58,7 +58,7 @@ module Nestor::Mappers::Rails
58
58
  log "Run all tests"
59
59
  test_files = load_test_files(["test"])
60
60
 
61
- ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
61
+ reset_db_connection_post_fork
62
62
  test_runner = ::Nestor::Mappers::Rails::Test::TestRunner.new(nil)
63
63
  result = ::Test::Unit::AutoRunner.run(false, nil, []) do |autorunner|
64
64
  autorunner.runner = lambda { test_runner }
@@ -76,7 +76,7 @@ module Nestor::Mappers::Rails
76
76
  log "Running #{focuses.length} focused tests"
77
77
  load_test_files(test_files)
78
78
 
79
- ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
79
+ reset_db_connection_post_fork
80
80
  test_runner = ::Nestor::Mappers::Rails::Test::TestRunner.new(nil)
81
81
  result = ::Test::Unit::AutoRunner.run(false, nil, []) do |autorunner|
82
82
  autorunner.runner = lambda { test_runner }
@@ -156,6 +156,13 @@ module Nestor::Mappers::Rails
156
156
 
157
157
  private
158
158
 
159
+ # In an ideal world, this wouldn't be required, but because we forked,
160
+ # the socket connection to the DB goes bad in the child process. Reset
161
+ # it here so we can use it.
162
+ def reset_db_connection_post_fork
163
+ ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
164
+ end
165
+
159
166
  def setup_lifeline
160
167
  ppid = Process.ppid
161
168
  log "Setting up lifeline on #{Process.pid} for #{Process.ppid}"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nestor}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Fran\303\247ois Beausoleil"]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "LICENSE",
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
+ "TODO",
27
28
  "VERSION",
28
29
  "bin/nestor",
29
30
  "doc/.gitignore",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nestor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"
@@ -67,6 +67,7 @@ files:
67
67
  - LICENSE
68
68
  - README.rdoc
69
69
  - Rakefile
70
+ - TODO
70
71
  - VERSION
71
72
  - bin/nestor
72
73
  - doc/.gitignore