test 3-framework
This commit is contained in:
parent
59a5541e45
commit
fd5747f4dc
6
Gemfile
6
Gemfile
|
@ -1,4 +1,4 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://ruby.taobao.org'
|
||||||
|
|
||||||
unless RUBY_PLATFORM =~ /w32/
|
unless RUBY_PLATFORM =~ /w32/
|
||||||
# unix-like only
|
# unix-like only
|
||||||
|
@ -19,6 +19,9 @@ gem 'acts-as-taggable-on', '2.4.1'
|
||||||
group :development do
|
group :development do
|
||||||
gem 'better_errors', path: 'lib/better_errors'
|
gem 'better_errors', path: 'lib/better_errors'
|
||||||
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
||||||
|
gem "guard-rails"
|
||||||
|
gem 'guard-minitest'
|
||||||
|
gem 'guard-spork'
|
||||||
if ENV['PRY']
|
if ENV['PRY']
|
||||||
gem 'pry'
|
gem 'pry'
|
||||||
gem 'pry-nav'
|
gem 'pry-nav'
|
||||||
|
@ -26,7 +29,6 @@ group :development do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
# shoulda的版本做了改动
|
|
||||||
#gem "shoulda", "~> 3.3.2"
|
#gem "shoulda", "~> 3.3.2"
|
||||||
gem "shoulda", "> 3.3.2"
|
gem "shoulda", "> 3.3.2"
|
||||||
gem "mocha", "~> 0.13.3"
|
gem "mocha", "~> 0.13.3"
|
||||||
|
|
53
Gemfile.lock
53
Gemfile.lock
|
@ -19,7 +19,7 @@ PATH
|
||||||
rails
|
rails
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://ruby.taobao.org/
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.13)
|
actionmailer (3.2.13)
|
||||||
|
@ -60,6 +60,8 @@ GEM
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
selenium-webdriver (~> 2.0)
|
selenium-webdriver (~> 2.0)
|
||||||
xpath (~> 1.0.0)
|
xpath (~> 1.0.0)
|
||||||
|
celluloid (0.15.2)
|
||||||
|
timers (~> 1.1.0)
|
||||||
childprocess (0.5.3)
|
childprocess (0.5.3)
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
climate_control (0.0.3)
|
climate_control (0.0.3)
|
||||||
|
@ -77,7 +79,24 @@ GEM
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.0.2)
|
execjs (2.0.2)
|
||||||
fastercsv (1.5.0)
|
fastercsv (1.5.0)
|
||||||
|
ffi (1.9.3)
|
||||||
ffi (1.9.3-x86-mingw32)
|
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)
|
hike (1.2.3)
|
||||||
htmlentities (4.3.2)
|
htmlentities (4.3.2)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
|
@ -89,16 +108,25 @@ GEM
|
||||||
kaminari (0.16.1)
|
kaminari (0.16.1)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 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)
|
mail (2.5.4)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
metaclass (0.0.4)
|
metaclass (0.0.4)
|
||||||
|
method_source (0.8.2)
|
||||||
mime-types (1.23)
|
mime-types (1.23)
|
||||||
|
minitest (5.4.0)
|
||||||
mocha (0.13.3)
|
mocha (0.13.3)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
multi_json (1.7.6)
|
multi_json (1.7.6)
|
||||||
|
mysql2 (0.3.11)
|
||||||
mysql2 (0.3.11-x86-mingw32)
|
mysql2 (0.3.11-x86-mingw32)
|
||||||
net-ldap (0.3.1)
|
net-ldap (0.3.1)
|
||||||
|
nokogiri (1.5.11)
|
||||||
nokogiri (1.5.11-x86-mingw32)
|
nokogiri (1.5.11-x86-mingw32)
|
||||||
paperclip (3.5.4)
|
paperclip (3.5.4)
|
||||||
activemodel (>= 3.0.0)
|
activemodel (>= 3.0.0)
|
||||||
|
@ -106,6 +134,17 @@ GEM
|
||||||
cocaine (~> 0.5.3)
|
cocaine (~> 0.5.3)
|
||||||
mime-types
|
mime-types
|
||||||
polyglot (0.3.3)
|
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 (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
|
@ -134,6 +173,9 @@ GEM
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
|
rb-fsevent (0.9.4)
|
||||||
|
rb-inotify (0.9.5)
|
||||||
|
ffi (>= 0.5.0)
|
||||||
rdoc (3.12.2)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
rich (1.4.6)
|
rich (1.4.6)
|
||||||
|
@ -163,6 +205,8 @@ GEM
|
||||||
shoulda-context (1.2.1)
|
shoulda-context (1.2.1)
|
||||||
shoulda-matchers (2.6.1)
|
shoulda-matchers (2.6.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
slop (3.5.0)
|
||||||
|
spork (0.9.2)
|
||||||
sprockets (2.2.2)
|
sprockets (2.2.2)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
@ -170,6 +214,7 @@ GEM
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
thor (0.18.1)
|
thor (0.18.1)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
|
timers (1.1.0)
|
||||||
treetop (1.4.14)
|
treetop (1.4.14)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
|
@ -178,6 +223,7 @@ GEM
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
websocket (1.0.7)
|
websocket (1.0.7)
|
||||||
|
win32console (1.3.2-x86-mingw32)
|
||||||
xpath (1.0.0)
|
xpath (1.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
|
@ -194,6 +240,9 @@ DEPENDENCIES
|
||||||
coderay (~> 1.0.6)
|
coderay (~> 1.0.6)
|
||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 3.2.1)
|
||||||
fastercsv (~> 1.5.0)
|
fastercsv (~> 1.5.0)
|
||||||
|
guard-minitest
|
||||||
|
guard-rails
|
||||||
|
guard-spork
|
||||||
htmlentities
|
htmlentities
|
||||||
i18n (~> 0.6.0)
|
i18n (~> 0.6.0)
|
||||||
jquery-rails (~> 2.0.2)
|
jquery-rails (~> 2.0.2)
|
||||||
|
@ -203,6 +252,8 @@ DEPENDENCIES
|
||||||
net-ldap (~> 0.3.1)
|
net-ldap (~> 0.3.1)
|
||||||
nokogiri (< 1.6.0)
|
nokogiri (< 1.6.0)
|
||||||
paperclip (~> 3.5.4)
|
paperclip (~> 3.5.4)
|
||||||
|
pry
|
||||||
|
pry-nav
|
||||||
rack-mini-profiler!
|
rack-mini-profiler!
|
||||||
rack-openid
|
rack-openid
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
|
|
|
@ -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
|
|
@ -163,7 +163,7 @@ class Setting < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# fixed domain url in development. tantantan's bug
|
# fixed domain url in development. tantantan's bug
|
||||||
if Rails.env.development?
|
if Rails.env.development? || Rails.env.test?
|
||||||
methods.map do |m|
|
methods.map do |m|
|
||||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ gem 'actionpack'
|
||||||
require 'action_controller'
|
require 'action_controller'
|
||||||
|
|
||||||
gem 'mocha'
|
gem 'mocha'
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
gem 'ruby-openid'
|
gem 'ruby-openid'
|
||||||
require 'openid'
|
require 'openid'
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
require File.expand_path('../../test_helper', __FILE__)
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
rescue
|
rescue
|
||||||
# Won't run some tests
|
# Won't run some tests
|
||||||
end
|
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
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class BazaarAdapterTest < ActiveSupport::TestCase
|
class BazaarAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class CvsAdapterTest < ActiveSupport::TestCase
|
class CvsAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class DarcsAdapterTest < ActiveSupport::TestCase
|
class DarcsAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class GitAdapterTest < ActiveSupport::TestCase
|
class GitAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class MercurialAdapterTest < ActiveSupport::TestCase
|
class MercurialAdapterTest < ActiveSupport::TestCase
|
||||||
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR
|
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class SubversionAdapterTest < ActiveSupport::TestCase
|
class SubversionAdapterTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue