app/models/part.rb
class Part < ActiveRecord::Base
def after_create
raise "no way" if self.name == "test"
end
end
app/controllers/parts_controller.rb
class PartsController < ApplicationController
def test
Part.create!(:name => "test")
end
end
test/functional ...
agideo@ats1:~/apps/app_name$ ruby script/server -e production
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails ...
# app\controllers\examples_controller.rb
ruby 代码
class ExamplesController < ApplicationController
def ajax_select
@items = %w{AA BB}
&n ...
1. 经常出现是的本机的 rake test 正常 但是 CC上却是错的, 花了N个小时后发现是 少了一个fixtures
原因是 本机与CC 服务器加载CC的顺序不一样.
随手写一个rake 来解决这个问题
ruby 代码
namespace :test do
task :each_file do
&n ...
在其它文章中看到 用rails ubuntu 性能最好
目前的项目 rake test 的速度让人受不了 就在自己家的电脑上小试了一把.
环境
CPU 赛扬 2.0
内存 512M
硬盘1
Ubuntu 7.04 (已经升级过了 到 7.10)
Rails 1.2.2
mysql Ver 14.12 Distrib 5.0.38, for pc-linux-gnu (i486) using readline 5.2
ruby 1.8.5 (2006-08-25) [i486-linux]
硬盘2
windows xp&n ...
注: 本片文章参考 redmine
1.
rails upload_file
2. database.yml
ruby 代码
development:
adapter: sqlite3
dbfile: db/dev.db
test:
adapter: sqlite3 &nb ...
ruby 代码
assert_raise(ActiveRecord::RecordNotFound) { # 注意:这个括句一定要在一行
# xxxx
}
- 浏览: 9592 次
- 性别:

- 来自: 温州

- 详细资料
搜索本博客
我的相册
action_auth
共 26 张
共 26 张
最近加入圈子
链接
最新评论
-
ruby 又一BUG 折磨了我很 ...
放这里记一下sudo apt-get install openssh-clien ...
-- by open2ye -
rails 的测试的 bug 当你 ...
还有一个可能造成这个问题的原因是rails test的transactional ...
-- by iamawalrus -
rails 的测试的 bug 当你 ...
gigix 写道 干嘛不放在before_save呢? 例如Part 在 be ...
-- by open2ye -
rails 的测试的 bug 当你 ...
iamawalrus 写道 检查test环境的db以及对应的table是否和de ...
-- by open2ye -
rails 的测试的 bug 当你 ...
open2ye 写道这个需求很普遍 比如一个是零件表, 另一个是零件的创建日志 ...
-- by iamawalrus






评论排行榜