mardi 30 juin 2015

Testing Lib Files in Ruby on Rails

I am developing a parser for a website. Right now, the parser is contained in a file titled input_parser.rb in my /lib directory. Currently, in my test file, which is titled input_parser_test.rb, I have to use the following lines in order for the parser to be loaded correctly:

    $LOAD_PATH.unshift File.expand_path '../../../lib',__FILE__
    require "input_parser"

How can I get Rails to auto load and detect the lib file? I currently have the test file in the test/unit/ directory, but I've tried putting it in test, test/lib, and test/unit/lib, and I still can't get it to auto load the path correctly. I've also check my config files to make sure that I haven't done anything strange to my requires. I'm fresh out of ideas, so any advice would be appreciated.

Aucun commentaire:

Enregistrer un commentaire