在测试单元2.3.0中使用“忽略”功能时出错
|
我对自己的问题有些困惑。我正在使用ruby 1.8.7,rails 2.3.2。我正在尝试使用2.3.0测试单元中的“省略”功能。这是我的测试:
def test_create_reward_program
omit(\"Pending\")
reward_program = RewardProgram.find_by_program_name(\"test_foo\")
assert_equal \"test_foo\", reward_program.program_name
end
当我运行“ rake test”时,得到以下信息:
1) Error:
test_create_reward_program(AwardControllerTest):
Test::Unit::OmittedError: Pending
/test/functional/award_controller_test.rb:43:in `test_create_reward_program\'
148 tests, 261 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0%通过
我不知道为什么它应该将其标记为“遗漏”时将其标记为“错误”。有人知道吗
我还注意到这确实有效:
def test_create_reward_program
omit \"Pending\" do
reward_program = RewardProgram.find_by_program_name(\"test_foo\")
assert_equal \"test_foo\", reward_program.program_name
end
end
我发现的所有教程和示例都表明我的第一个示例应该可行。
没有找到相关结果
已邀请:
1 个回复
芦歉竭皑
顺便说一句,如果您进行了升级,则与Minitest捆绑在一起的运行在Ruby 1.9.2p0上的Rails 3.1.0.rc1不会定义“ 3”,而是会添加“ 6”。例如:
使用
宝石漂亮地打印输出,我得到: