themirror
themirror

Reputation: 10287

Ruby testing: printing inside a test case

I'm brand new to Ruby testing and Google isn't helping.

Using Test/Unit, how can I print an instance variable, like

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

Upvotes: 0

Views: 1327

Answers (1)

Gutzofter
Gutzofter

Reputation: 2023

Ruby asserts can output messages to test runner console:

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

Upvotes: 1

Related Questions