Skip to content

Commit

Permalink
Switch to autotest for continuous dev testing
Browse files Browse the repository at this point in the history
Guard does not work with minitest and spark.
  • Loading branch information
Sproinks committed Sep 7, 2012
1 parent eb16f4f commit eded5cf
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 55 deletions.
12 changes: 12 additions & 0 deletions .autotest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'autotest/fsevent'

class Autotest
# run tests over drb server (spork)
def make_test_cmd files_to_test
if files_to_test.empty?
"" # no tests to run
else
"testdrb #{files_to_test.keys.join(' ')}"
end
end
end
18 changes: 11 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ group :test, :develop do
gem 'cover_me'
gem 'minitest'
gem 'mocha', :require => false
gem 'spork', "~> 0.9.0"
gem 'rb-inotify' if RUBY_PLATFORM.downcase.include?("linux")
gem 'rb-fsevent', "~> 0.9.0" if RUBY_PLATFORM.downcase.include?("darwin")
gem 'guard', "~> 1.0.1"
gem 'guard-spork', "~> 0.5.2"
gem 'guard-minitest', "~> 0.5.0"
gem 'spork-testunit', "~> 0.0.8"

# spork and autotest allow you to run tests when you save a file.
# run `spork` in one terminal from the project root.
# run `bundle exec autotest -cf` in one terminal from the project root.
# Then edit test files or app/* or lib/* and watch tests run automatically on save.
gem 'spork' # Spork caches rails so tests run fast.
# Run 'bundle exec autotest' to rerun relevant tests whenever a file/test is changed.
gem 'autotest-standalone' # The file '.autotest' makes sure the tests are run via test server (spork).
gem 'autotest-rails-pure' # -pure gives us autotest without ZenTest gem.
gem 'autotest-fsevent' # react to filesystem events, save your CPU
gem 'spork-minitest'
end

group :production do
Expand Down
34 changes: 15 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ GEM
multi_json (~> 1.0)
ansi (1.4.2)
arel (3.0.2)
autotest-fsevent (0.2.8)
sys-uname
autotest-rails-pure (4.1.2)
autotest-standalone (4.5.9)
bcrypt-ruby (3.0.1)
bson (1.6.4)
bson_ext (1.6.2)
Expand Down Expand Up @@ -110,21 +114,13 @@ GEM
activesupport (>= 3.0.0)
faraday (0.8.1)
multipart-post (~> 1.1)
ffi (1.0.11)
ffi (1.1.5)
foreman (0.46.0)
thor (>= 0.13.6)
google-spreadsheet-ruby (0.1.8)
nokogiri (>= 1.4.3.1)
oauth (>= 0.3.6)
oauth2 (>= 0.5.0)
guard (1.0.2)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-minitest (0.5.0)
guard (>= 0.4)
guard-spork (0.5.2)
guard (>= 0.10.0)
spork (>= 0.8.4)
hashie (1.2.0)
hike (1.2.1)
httpauth (0.1)
Expand Down Expand Up @@ -200,7 +196,6 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rb-fsevent (0.9.1)
rdoc (3.12)
json (~> 1.4)
ref (1.0.0)
Expand All @@ -222,15 +217,17 @@ GEM
actionpack (~> 3.0)
activemodel (~> 3.0)
slop (2.4.4)
spork (0.9.1)
spork-testunit (0.0.8)
spork (>= 0.6.0)
spork (0.9.2)
spork-minitest (0.0.3)
spork
spreadsheet (0.6.8)
ruby-ole (>= 1.0)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sys-uname (0.9.0)
ffi (>= 1.0.0)
systemu (2.5.2)
therubyracer (0.11.0beta6)
ref
Expand All @@ -257,6 +254,9 @@ PLATFORMS
ruby

DEPENDENCIES
autotest-fsevent
autotest-rails-pure
autotest-standalone
bson
bson_ext
cancan
Expand All @@ -266,9 +266,6 @@ DEPENDENCIES
devise
factory_girl
foreman
guard (~> 1.0.1)
guard-minitest (~> 0.5.0)
guard-spork (~> 0.5.2)
health-data-standards!
hqmf-parser!
hqmf2js!
Expand All @@ -283,11 +280,10 @@ DEPENDENCIES
pry
pry-nav
rails (= 3.2.2)
rb-fsevent (~> 0.9.0)
sass-rails (~> 3.2.3)
simple_form
spork (~> 0.9.0)
spork-testunit (~> 0.0.8)
spork
spork-minitest
test-patient-generator!
therubyracer (~> 0.11.0beta5)
turn
Expand Down
22 changes: 0 additions & 22 deletions Guardfile

This file was deleted.

18 changes: 11 additions & 7 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
require 'cover_me' # cover_me docs say it needs to be the first line in test_helper
require 'rubygems'
require 'spork'

require 'minitest/autorun'
require 'minitest/unit'

Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
require 'cover_me'
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

require 'factory_girl'
FactoryGirl.find_definitions

require 'mocha'
require 'rake'

# you will have to restart guard when you modify factories
# if you don't like this, put this line under #each_run()
FactoryGirl.find_definitions
require 'turn'
require 'rails/test_help'
end

Spork.each_run do
# This code will be run each time you run your specs.
FactoryGirl.reload
Rails.application.reload_routes!
end

class ActiveSupport::TestCase
Expand Down Expand Up @@ -73,4 +77,4 @@ class << fixture
end
fixture
end
end
end

0 comments on commit eded5cf

Please sign in to comment.