diff --git a/Gemfile b/Gemfile index 4d9e788d8..0965c955a 100644 --- a/Gemfile +++ b/Gemfile @@ -19,13 +19,6 @@ gem 'acts-as-taggable-on', '2.4.1' group :development do gem 'better_errors', path: 'lib/better_errors' gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' - gem "guard-rails" - gem 'guard-minitest' - gem 'guard-spork' - if ENV['PRY'] - gem 'pry' - gem 'pry-nav' - end end group :test do @@ -36,6 +29,16 @@ group :test do gem 'nokogiri', '< 1.6.0' end +group :development, :test do + gem "guard-rails" + gem 'spork-testunit' + gem 'guard-spork' + gem 'guard-test', '~> 1.0.0' + gem 'ruby-prof' + gem 'pry' + gem 'pry-nav' +end + # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index 78b643e44..fe06a5e46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,7 +51,7 @@ GEM multi_json (~> 1.0) acts-as-taggable-on (2.4.1) rails (>= 3, < 5) - arel (3.0.2) + arel (3.0.3) builder (3.0.0) capybara (2.0.3) mime-types (>= 1.16) @@ -72,13 +72,13 @@ GEM coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) - coffee-script (2.2.0) + coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.7.0) + coffee-script-source (1.7.1) erubis (2.7.0) - execjs (2.0.2) - fastercsv (1.5.0) + execjs (2.2.1) + fastercsv (1.5.5) ffi (1.9.3) ffi (1.9.3-x86-mingw32) formatador (0.2.5) @@ -88,26 +88,28 @@ GEM lumberjack (~> 1.0) pry (>= 0.9.12) thor (>= 0.18.1) - guard-minitest (2.3.1) - guard (~> 2.0) - minitest (>= 3.0) guard-rails (0.5.2) guard (~> 2.0) guard-spork (1.5.1) childprocess (>= 0.2.3) guard (>= 1.1) spork (>= 0.8.4) + guard-test (1.0.0) + guard (>= 1.8) + test-unit (~> 2.2) hike (1.2.3) htmlentities (4.3.2) i18n (0.6.1) + iconv (1.0.4) journey (1.0.4) jquery-rails (2.0.3) railties (>= 3.1.0, < 5.0) thor (~> 0.14) - json (1.8.0) + json (1.8.1) kaminari (0.16.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) + libv8 (3.16.14.3) listen (2.7.9) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) @@ -118,11 +120,10 @@ GEM treetop (~> 1.4.8) metaclass (0.0.4) method_source (0.8.2) - mime-types (1.23) - minitest (5.4.0) + mime-types (1.25.1) mocha (0.13.3) metaclass (~> 0.0.1) - multi_json (1.7.6) + multi_json (1.10.1) mysql2 (0.3.11) mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) @@ -133,7 +134,7 @@ GEM activesupport (>= 3.0.0) cocaine (~> 0.5.3) mime-types - polyglot (0.3.3) + polyglot (0.3.5) pry (0.9.12.6) coderay (~> 1.0) method_source (~> 0.8) @@ -148,12 +149,12 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-openid (1.3.1) + rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) rack-raw-upload (1.1.1) multi_json - rack-ssl (1.3.3) + rack-ssl (1.3.4) rack rack-test (0.6.2) rack (>= 1.0) @@ -178,6 +179,7 @@ GEM ffi (>= 0.5.0) rdoc (3.12.2) json (~> 1.4) + ref (1.0.5) rich (1.4.6) jquery-rails kaminari @@ -188,8 +190,9 @@ GEM sass-rails rmagick (2.13.2) ruby-openid (2.1.8) - rubyzip (1.1.4) - sass (3.2.14) + ruby-prof (0.15.1) + rubyzip (1.1.6) + sass (3.3.10) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) @@ -207,27 +210,36 @@ GEM activesupport (>= 3.0.0) slop (3.5.0) spork (0.9.2) + spork-testunit (0.0.8) + spork (>= 0.6.0) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - thor (0.18.1) + test-unit (2.5.5) + therubyracer (0.12.1) + libv8 (~> 3.16.14.0) + ref + thor (0.19.1) tilt (1.4.1) timers (1.1.0) - treetop (1.4.14) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.37) - uglifier (2.4.0) + tzinfo (0.3.40) + uglifier (2.5.1) execjs (>= 0.3.0) json (>= 1.8.0) websocket (1.0.7) win32console (1.3.2-x86-mingw32) xpath (1.0.0) nokogiri (~> 1.3) + zip-zip (0.3) + rubyzip (>= 1.0.0) PLATFORMS + ruby x86-mingw32 DEPENDENCIES @@ -240,11 +252,12 @@ DEPENDENCIES coderay (~> 1.0.6) coffee-rails (~> 3.2.1) fastercsv (~> 1.5.0) - guard-minitest guard-rails guard-spork + guard-test (~> 1.0.0) htmlentities i18n (~> 0.6.0) + iconv jquery-rails (~> 2.0.2) kaminari mocha (~> 0.13.3) @@ -260,8 +273,12 @@ DEPENDENCIES rich (= 1.4.6) rmagick (>= 2.0.0) ruby-openid (~> 2.1.4) + ruby-prof + rubyzip sass-rails (~> 3.2.3) seems_rateable! shoulda (> 3.3.2) + spork-testunit therubyracer uglifier (>= 1.0.3) + zip-zip diff --git a/Guardfile b/Guardfile index c30f4195e..75aa93c15 100644 --- a/Guardfile +++ b/Guardfile @@ -1,39 +1,11 @@ -# A sample Guardfile # More info at https://github.com/guard/guard#readme -guard 'rails' do - watch('Gemfile.lock') - watch(%r{^(config|lib)/.*}) -end - - -guard :minitest, :drb => true, test_folders: 'test/unit', test_file_patterns: '*_test.rb' do - # with Minitest::Unit - watch(%r{^test/(.*)\/?test_(.*)\.rb$}) - watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } - watch(%r{^test/test_helper\.rb$}) { 'test' } - - # with Minitest::Spec - # watch(%r{^spec/(.*)_spec\.rb$}) - # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } - # watch(%r{^spec/spec_helper\.rb$}) { 'spec' } - - # Rails 4 - # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } - # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' } - # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" } - # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" } - # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" } - # watch(%r{^test/.+_test\.rb$}) - # watch(%r{^test/test_helper\.rb$}) { 'test' } - - # Rails < 4 - watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" } - watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" } - watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" } -end - -guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do +# guard 'rails' do +# watch('Gemfile.lock') +# watch(%r{^(config|lib)/.*}) +# end +# +guard 'spork', :test_unit => true, :test_unit_env => {'RAILS_ENV' => 'test'}, :wait => 60 do watch('config/application.rb') watch('config/environment.rb') watch('config/environments/test.rb') @@ -43,3 +15,25 @@ guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAIL watch('test/test_helper.rb') { :test_unit } watch(%r{features/support/}) { :cucumber } end + +guard :test, :drb => true, :all_after_pass => false, :all_on_start => false do + watch(%r{^test/.+_test\.rb$}) + watch('test/test_helper.rb') { 'test' } + + # Non-rails + watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } + + # Rails 4 + # watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" } + # watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' } + # watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" } + # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" } + # watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" } + + # Rails < 4 + watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" } + watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" } + watch(%r{^app/views/(.+)/.+\.erb$}) { |m| "test/functional/#{m[1]}_controller_test.rb" } + watch(%r{^app/views/.+$}) { 'test/integration' } + watch('app/controllers/application_controller.rb') { ['test/functional', 'test/integration'] } +end diff --git a/doc/Automated testing documentation.doc b/doc/Automated testing documentation.doc new file mode 100644 index 000000000..d01506181 Binary files /dev/null and b/doc/Automated testing documentation.doc differ diff --git a/test/test_helper.rb b/test/test_helper.rb index 8d0666854..9b1a4f158 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,55 @@ +require 'rubygems' +require 'spork' +#uncomment the following line to use spork with the debugger +#require 'spork/ext/ruby-debug' + +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. + ENV["RAILS_ENV"] = "test" + require File.expand_path('../../config/environment', __FILE__) + require 'rails/test_help' + +end + +Spork.each_run do + # This code will be run each time you run your specs. + +end + +# --- Instructions --- +# Sort the contents of this file into a Spork.prefork and a Spork.each_run +# block. +# +# The Spork.prefork block is run only once when the spork server is started. +# You typically want to place most of your (slow) initializer code in here, in +# particular, require'ing any 3rd-party gems that you don't normally modify +# during development. +# +# The Spork.each_run block is run each time you run your specs. In case you +# need to load files that tend to change during development, require them here. +# With Rails, your application modules are loaded automatically, so sometimes +# this block can remain empty. +# +# Note: You can modify files loaded *from* the Spork.each_run block without +# restarting the spork server. However, this file itself will not be reloaded, +# so if you change any of the code inside the each_run block, you still need to +# restart the server. In general, if you have non-trivial code in this file, +# it's advisable to move it into a separate file so you can easily edit it +# without restarting spork. (For example, with RSpec, you could move +# non-trivial code into a file spec/support/my_helper.rb, making sure that the +# spec/support/* files are require'd from inside the each_run block.) +# +# Any code that is left outside the two blocks will be run during preforking +# *and* during each_run -- that's probably not what you want. +# +# These instructions should self-destruct in 10 seconds. If they don't, feel +# free to delete them. + + + + # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang #