interface icon indicating copy to clipboard operation
interface copied to clipboard

Test for all bad interfaces at ones

Open simcha opened this issue 15 years ago • 2 comments

I added test all interfaces feature. It requires to switch on class and module registering, so we don't make memory leaks on production. And is intended to be run separately in the unit test. For now I did not added top level methods to interface as I don't like the names and thought that you may find better ones. The top level test will look something like:

require 'interface'
Interface::Abstract.register_classes = true
require 'my-project-libs'

class AllTest < Test::Unit::TestCase
   test_all_interfaces
      assert Interface::Abstract.bad_interfaces.empty?
   end
end

We can define some helper class to make this test even simpler. The test for your test classes is included in the fork in all_bad_interfaces_test.rb file.

simcha avatar Feb 20 '11 13:02 simcha

I just realized that there is a bug in my code. Your method unimplemented_methods_for is a object level not class level method and as such can't be called I added "new" there but it will not work in production. We can:

a. change method to class level (it is class level I think) b. replicate code in Abstract class

Tell me pls. what you think.

simcha avatar Feb 20 '11 13:02 simcha

I saw that you use "respond_to_missing?" so I have implemented (b) and replicated the code in more static way.

simcha avatar Feb 20 '11 14:02 simcha