Skip to content

Commit

Permalink
bugfix: don't load app/test frameworks from other versions of spork
Browse files Browse the repository at this point in the history
  • Loading branch information
timcharper committed Nov 4, 2009
1 parent de9c6c1 commit f485df8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/spork.rb
Expand Up @@ -84,11 +84,19 @@ def trap_class_method(klass, method_name)
end

def detect_and_require(subfolder)
([LIBDIR.to_s] + Gem.latest_load_paths.grep(/spork/)).uniq.each do |gem_path|
([LIBDIR.to_s] + other_spork_gem_load_paths).uniq.each do |gem_path|
Dir.glob(File.join(gem_path, subfolder)).each { |file| require file }
end
end

def other_spork_gem_load_paths
@other_spork_gem_load_paths ||= (
Gem.latest_load_paths.grep(/spork/).select do |g|
not g.match(%r{/spork-[0-9\-.]+/lib}) # don't include other versions of spork
end
)
end

private
def alias_method_names(method_name, feature)
/^(.+?)([\?\!]{0,1})$/.match(method_name.to_s)
Expand Down

0 comments on commit f485df8

Please sign in to comment.