Correct way to test lib folder with rspec?

rspec, ruby-on-rails

Solution

The way you've done it -- `require 'parser'` is the recommended way. RSpec puts `lib` on the `$LOAD_PATH` so that you can require files relative to it, just like you've done.

Problem

I have a test that tries to test a class located in lib folder. Right now I do this in my parser_spec.rb ``` require 'spec_helper' require 'parser' --> Because my class is /lib/parser.rb describe "parser" do it "needs a url to initialize" do expect { Parser.new }.to raise_error(ArgumentError) end end ``` What would be the correct way to include all the lib files, so that they are in the scope of the rspec tests?

Original source