mercredi 2 mars 2016

using single assert_equals statement in a Ruby Program

I am reading through "Metaprogramming Ruby 2: Program Like the Ruby Pros" and am a bit puzzled.

Often, the exercise files will have require_relative '../test/assertions' statement at the end of them and then one or two lines of assert_equals statements like so

require_relative '../test/assertions'
assert_equals 6, obj.send(:my_method, 3)

To be clear, these are testing code that is just a few lines up in the same file. I have set up many minitests, but never something quite so succinct! I get a load error when I try to run the file. I tried adding empty test and assertion folders, but unsurprisingly I still get a load error:

dynamic_call.rb:20:in `require_relative': cannot load such file --

What do i need to do to be able to use these assert_equals tests?

Aucun commentaire:

Enregistrer un commentaire