[rspec-devel] [ rspec-Feature Requests-10814 ] Runner loads shared code, test cases require them again

noreply at rubyforge.org noreply at rubyforge.org
Sun May 13 19:03:24 EDT 2007


Feature Requests item #10814, was opened at 2007-05-13 23:03
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=10814&group_id=797

Category: runner / command line
Group: None
Status: Open
Priority: 3
Submitted By: Assaf Arkin (assaf)
Assigned to: Nobody (None)
Summary: Runner loads shared code, test cases require them again

Initial Comment:
Our test directory contains one file that provides methods and behaviores shared by all other test files. To run individual files, each one requires that shared file. 

However, when running spec test, RSpec loads all the files from the test directory (and its sub-directories). So the file gets loaded once (by RSpec) and required once (by the test files), and interpreted twice (by Ruby). Some of the code doesn't like that.

The current workaround is to detect the second load and ignore it (e.g. unless defined?(SomeConst)). But given the amount of time it took to find the culprit and work around it, can RSpec require the file instead, or allow a directory of shared behaviors not loaded by default?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=10814&group_id=797


More information about the rspec-devel mailing list