Rails: How to test code in the lib/ directory?

前端 未结 7 1571

I have a model which gets its data from a parser object. I\'m thinking that the parser class should live in the lib/ directory (although I could be persuaded that it should live

7条回答
  •  难免孤独
    2021-01-30 07:01

    An easy and clean way is just to create a directory under test/unit/lib. Then create test as test/unit/lib/foo_test.rb corresponding to lib/foo.rb. No new rake tasks required, and you can nest more directories if needed to match the lib directory structure.

提交回复
热议问题