Class: Guard::JRubyMinitest::TestPathsReloader
- Inherits:
-
Object
- Object
- Guard::JRubyMinitest::TestPathsReloader
- Extended by:
- TestPaths
- Defined in:
- lib/guard/jruby-minitest/reloaders/test_paths_reloader.rb
Instance Attribute Summary
Attributes included from TestPaths
Class Method Summary collapse
Methods included from TestPaths
Class Method Details
.run(paths) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/guard/jruby-minitest/reloaders/test_paths_reloader.rb', line 8 def self.run(paths) paths.select{|p| in_test_folders?(p)}.each do |p| if File.exists?(p) Containment.new.protect { unload p; load p } end end end |
.unload(path) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/guard/jruby-minitest/reloaders/test_paths_reloader.rb', line 16 def self.unload(path) code = RubyParser.new.parse(IO.read(path)) test_classes = [] test_classes << code[1] if code[0] == :class code.each_of_type(:class) {|c| test_classes << c[1] if c[1].is_a?(Symbol) } test_classes.each do |c| Object.send(:remove_const, c) if Object.const_defined?(c) end end |