Ruby测试:在测试用例中打印

时间:2010-06-12 06:32:49

标签: ruby unit-testing

我是Ruby测试的新手,Google没有帮助。

使用Test / Unit,如何打印实例变量,如

test "thing to happen" do
  do_stuff
  assert_equal "foo", @variable
  p @varible
end

1 个答案:

答案 0 :(得分:1)

Ruby asserts可以输出消息来测试跑步者控制台:

test "thing to happen" do
  do_stuff
  assert_equal "foo", @variable, "@variable is #{@variable} when: things to happen"
  p @varible
end