我有点被我的问题难住了。我正在使用 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
我发现的所有教程和示例都表明我的第一个示例应该可以工作。