[rspec-users] spec'ing the existence of #require

Matt Wynne matt at mattwynne.net
Sun Aug 31 13:26:49 EDT 2008


Could you put a mocking expectation on Kernel? (which is where  
#require is defined)

Kernel.should_receive(:require).with(expected_file_name)


On 31 Aug 2008, at 15:36, Chuck Remes wrote:

> I looked through the mailing list archive but unfortunately my  
> search terms are too generic (spec and require...).
>
> I am writing ruby code that runs under jruby in an embedded  
> environment. Periodically I will install new code that passes all  
> specs only to have it fail when it can't find a new class I defined  
> (missing #require).
>
> My spec_helper.rb file does a wildcard search and loads all rb  
> files in the tree, so it always picks up new files. Clearly I need  
> to change that and be more specific in my require lines.
>
> Any suggestions on how to best accomplish this?
>
> cr
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list