自动化测试框架
This commit is contained in:
commit
ec2384f110
17
Gemfile
17
Gemfile
|
@ -1,4 +1,4 @@
|
|||
source 'https://rubygems.org'
|
||||
source 'https://ruby.taobao.org'
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
|
@ -19,14 +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'
|
||||
if ENV['PRY']
|
||||
gem 'pry'
|
||||
gem 'pry-nav'
|
||||
end
|
||||
end
|
||||
|
||||
group :test do
|
||||
# shoulda的版本做了改动
|
||||
#gem "shoulda", "~> 3.3.2"
|
||||
gem "shoulda", "> 3.3.2"
|
||||
gem "mocha", "~> 0.13.3"
|
||||
|
@ -34,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.
|
||||
|
|
104
Gemfile.lock
104
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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -70,51 +72,89 @@ 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)
|
||||
guard (2.6.1)
|
||||
formatador (>= 0.2.4)
|
||||
listen (~> 2.7)
|
||||
lumberjack (~> 1.0)
|
||||
pry (>= 0.9.12)
|
||||
thor (>= 0.18.1)
|
||||
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)
|
||||
rb-inotify (>= 0.9)
|
||||
lumberjack (1.0.9)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
metaclass (0.0.4)
|
||||
mime-types (1.23)
|
||||
method_source (0.8.2)
|
||||
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)
|
||||
nokogiri (1.5.11)
|
||||
nokogiri (1.5.11-x86-mingw32)
|
||||
paperclip (3.5.4)
|
||||
activemodel (>= 3.0.0)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
|
@ -134,8 +174,12 @@ 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)
|
||||
ref (1.0.5)
|
||||
rich (1.4.6)
|
||||
jquery-rails
|
||||
kaminari
|
||||
|
@ -146,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)
|
||||
|
@ -163,25 +208,38 @@ GEM
|
|||
shoulda-context (1.2.1)
|
||||
shoulda-matchers (2.6.1)
|
||||
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)
|
||||
treetop (1.4.14)
|
||||
timers (1.1.0)
|
||||
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
|
||||
|
@ -194,8 +252,12 @@ DEPENDENCIES
|
|||
coderay (~> 1.0.6)
|
||||
coffee-rails (~> 3.2.1)
|
||||
fastercsv (~> 1.5.0)
|
||||
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)
|
||||
|
@ -203,14 +265,20 @@ 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)
|
||||
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
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
# 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')
|
||||
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
|
||||
|
||||
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
|
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ gem 'actionpack'
|
|||
require 'action_controller'
|
||||
|
||||
gem 'mocha'
|
||||
require 'mocha'
|
||||
require 'mocha/setup'
|
||||
|
||||
gem 'ruby-openid'
|
||||
require 'openid'
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
begin
|
||||
require 'mocha'
|
||||
require 'mocha/setup'
|
||||
rescue
|
||||
# Won't run some tests
|
||||
end
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||
|
||||
begin
|
||||
require 'mocha'
|
||||
require 'mocha/setup'
|
||||
|
||||
class SubversionAdapterTest < ActiveSupport::TestCase
|
||||
|
||||
|
|
Loading…
Reference in New Issue