From fd5747f4dc558eb9dd27c733c4b433da97e4faf0 Mon Sep 17 00:00:00 2001 From: yanxd Date: Mon, 14 Jul 2014 10:27:54 +0800 Subject: [PATCH 1/2] test 3-framework --- Gemfile | 6 ++- Gemfile.lock | 53 ++++++++++++++++++- Guardfile | 45 ++++++++++++++++ app/models/setting.rb | 2 +- .../test/test_helper.rb | 2 +- test/integration/account_test.rb | 2 +- test/integration/routing/courses_test.rb | 27 ++++++++++ .../scm/adapters/bazaar_adapter_test.rb | 2 +- .../redmine/scm/adapters/cvs_adapter_test.rb | 2 +- .../scm/adapters/darcs_adapter_test.rb | 2 +- .../redmine/scm/adapters/git_adapter_test.rb | 2 +- .../scm/adapters/mercurial_adapter_test.rb | 2 +- .../scm/adapters/subversion_adapter_test.rb | 2 +- 13 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 Guardfile create mode 100644 test/integration/routing/courses_test.rb diff --git a/Gemfile b/Gemfile index 634af9683..4d9e788d8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'https://rubygems.org' +source 'https://ruby.taobao.org' unless RUBY_PLATFORM =~ /w32/ # unix-like only @@ -19,6 +19,9 @@ 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' @@ -26,7 +29,6 @@ group :development do end group :test do - # shoulda的版本做了改动 #gem "shoulda", "~> 3.3.2" gem "shoulda", "> 3.3.2" gem "mocha", "~> 0.13.3" diff --git a/Gemfile.lock b/Gemfile.lock index d30eb7bc4..78b643e44 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ PATH rails GEM - remote: https://rubygems.org/ + remote: https://ruby.taobao.org/ remote: https://rubygems.org/ specs: actionmailer (3.2.13) @@ -60,6 +60,8 @@ GEM rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 1.0.0) + celluloid (0.15.2) + timers (~> 1.1.0) childprocess (0.5.3) ffi (~> 1.0, >= 1.0.11) climate_control (0.0.3) @@ -77,7 +79,24 @@ GEM erubis (2.7.0) execjs (2.0.2) fastercsv (1.5.0) + ffi (1.9.3) ffi (1.9.3-x86-mingw32) + formatador (0.2.5) + guard (2.6.1) + formatador (>= 0.2.4) + listen (~> 2.7) + 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) hike (1.2.3) htmlentities (4.3.2) i18n (0.6.1) @@ -89,16 +108,25 @@ GEM kaminari (0.16.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) + listen (2.7.9) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) metaclass (0.0.4) + method_source (0.8.2) mime-types (1.23) + minitest (5.4.0) mocha (0.13.3) metaclass (~> 0.0.1) multi_json (1.7.6) + mysql2 (0.3.11) mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) + nokogiri (1.5.11) nokogiri (1.5.11-x86-mingw32) paperclip (3.5.4) activemodel (>= 3.0.0) @@ -106,6 +134,17 @@ GEM cocaine (~> 0.5.3) mime-types polyglot (0.3.3) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + pry (0.9.12.6-x86-mingw32) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + win32console (~> 1.3) + pry-nav (0.2.3) + pry (~> 0.9.10) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) @@ -134,6 +173,9 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.3.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) rdoc (3.12.2) json (~> 1.4) rich (1.4.6) @@ -163,6 +205,8 @@ GEM shoulda-context (1.2.1) shoulda-matchers (2.6.1) activesupport (>= 3.0.0) + slop (3.5.0) + spork (0.9.2) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -170,6 +214,7 @@ GEM tilt (~> 1.1, != 1.3.0) thor (0.18.1) tilt (1.4.1) + timers (1.1.0) treetop (1.4.14) polyglot polyglot (>= 0.3.1) @@ -178,6 +223,7 @@ GEM 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) @@ -194,6 +240,9 @@ DEPENDENCIES coderay (~> 1.0.6) coffee-rails (~> 3.2.1) fastercsv (~> 1.5.0) + guard-minitest + guard-rails + guard-spork htmlentities i18n (~> 0.6.0) jquery-rails (~> 2.0.2) @@ -203,6 +252,8 @@ DEPENDENCIES net-ldap (~> 0.3.1) nokogiri (< 1.6.0) paperclip (~> 3.5.4) + pry + pry-nav rack-mini-profiler! rack-openid rails (= 3.2.13) diff --git a/Guardfile b/Guardfile new file mode 100644 index 000000000..c30f4195e --- /dev/null +++ b/Guardfile @@ -0,0 +1,45 @@ +# 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 + watch('config/application.rb') + watch('config/environment.rb') + watch('config/environments/test.rb') + watch(%r{^config/initializers/.+\.rb$}) + watch('Gemfile.lock') + watch('spec/spec_helper.rb') { :rspec } + watch('test/test_helper.rb') { :test_unit } + watch(%r{features/support/}) { :cucumber } +end diff --git a/app/models/setting.rb b/app/models/setting.rb index 583d034df..3f11ef7c2 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -163,7 +163,7 @@ class Setting < ActiveRecord::Base end # fixed domain url in development. tantantan's bug - if Rails.env.development? + if Rails.env.development? || Rails.env.test? methods.map do |m| define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/ end diff --git a/lib/plugins/open_id_authentication/test/test_helper.rb b/lib/plugins/open_id_authentication/test/test_helper.rb index 43216e1ef..cb76ceddc 100644 --- a/lib/plugins/open_id_authentication/test/test_helper.rb +++ b/lib/plugins/open_id_authentication/test/test_helper.rb @@ -8,7 +8,7 @@ gem 'actionpack' require 'action_controller' gem 'mocha' -require 'mocha' +require 'mocha/setup' gem 'ruby-openid' require 'openid' diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb index 7562bcf7c..fcb3ce4f8 100644 --- a/test/integration/account_test.rb +++ b/test/integration/account_test.rb @@ -18,7 +18,7 @@ require File.expand_path('../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' rescue # Won't run some tests end diff --git a/test/integration/routing/courses_test.rb b/test/integration/routing/courses_test.rb new file mode 100644 index 000000000..5554cb03d --- /dev/null +++ b/test/integration/routing/courses_test.rb @@ -0,0 +1,27 @@ +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require File.expand_path('../../../test_helper', __FILE__) + +class RoutingProjectsTest < ActionController::IntegrationTest + def test_courses + assert_routing( + { :method => 'get', :path => "/courses" }, + { :controller => 'projects', :action => 'index' } + ) + end +end diff --git a/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb index d69da033f..3e3f6ca88 100644 --- a/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb @@ -17,7 +17,7 @@ require File.expand_path('../../../../../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' class BazaarAdapterTest < ActiveSupport::TestCase REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s diff --git a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb index 6b2a804e0..cddedf871 100644 --- a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb @@ -17,7 +17,7 @@ require File.expand_path('../../../../../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' class CvsAdapterTest < ActiveSupport::TestCase REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s diff --git a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb index 5b689001a..f5a642689 100644 --- a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb @@ -17,7 +17,7 @@ require File.expand_path('../../../../../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' class DarcsAdapterTest < ActiveSupport::TestCase REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index 946ea4bfa..443b900bf 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -17,7 +17,7 @@ require File.expand_path('../../../../../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' class GitAdapterTest < ActiveSupport::TestCase REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s diff --git a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb index c23e7debd..ee31ff030 100644 --- a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb @@ -17,7 +17,7 @@ require File.expand_path('../../../../../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' class MercurialAdapterTest < ActiveSupport::TestCase HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR diff --git a/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb index 8bf08f011..dba1a6d43 100644 --- a/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb @@ -18,7 +18,7 @@ require File.expand_path('../../../../../../test_helper', __FILE__) begin - require 'mocha' + require 'mocha/setup' class SubversionAdapterTest < ActiveSupport::TestCase From 14f1ad63d220735bafe08d23e503a97803bf1140 Mon Sep 17 00:00:00 2001 From: yanxd Date: Mon, 14 Jul 2014 16:11:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 17 ++++--- Gemfile.lock | 61 ++++++++++++++--------- Guardfile | 62 +++++++++++------------- doc/Automated testing documentation.doc | Bin 0 -> 16896 bytes test/test_helper.rb | 52 ++++++++++++++++++++ 5 files changed, 129 insertions(+), 63 deletions(-) create mode 100644 doc/Automated testing documentation.doc 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 0000000000000000000000000000000000000000..d015061817d10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ukgWm@RfX9G~u>a2j_zeI)g@}aXktk0Hln`}Pa9AmjADRrN4-UoBDGRt{U}s`BP*P(N#RFwp(HcrM1Gb!3BGQUJ z0ujfmICnI_4}CwX|No@h8~Q(F!}XNkRP}{F^VP&WwBLz$6xBFY{@ifnBj!!O`3t|Y z;h_q@ksgs)DKuNs(5~^{07~I$M3d1v+hw2PZJ+Y;^oOAspDH(@=VvNITDX0-&0y3z z@|CiFA3mNT5${3y|5bd`!T-Ycw literal 0 HcmV?d00001 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 #