mercredi 18 novembre 2015

ruby unit testing at_start not found

I am using test-unit-2.5.5 with ruby 1.9.3. In http://ift.tt/1HVXdB6 there is a method called at_start as part of the ruby test::unit module from version 2.5.2. I tried to use it from the examples on the page like so:

class TestAOS < Test::Unit::TestCase
  Test::Unit.at_start do
    puts "start"
  end
  Test::Unit.at_exit do
    puts "Exit!"
  end

But when I run my test I get the following:

NoMethodError: undefined method `at_start' for Test::Unit:Module
  TestAOS at unit/TestAOS.rb:8
   (root) at unit/TestAOS.rb:7

Do I need to do anything first before this method can be used? I'm new to ruby

When I comment out the at_start bloack and run the test I get a different error for at_exit:

NoMethodError: private method `at_exit' called for Test::Unit:Module
  TestAOS at unit/TestAOS.rb:12
   (root) at unit/TestAOS.rb:7

A

Aucun commentaire:

Enregistrer un commentaire