Minor cleanups

* Use correct to_source api
* Use toplevel mutant.
This commit is contained in:
Markus Schirp 2012-08-20 04:50:07 +02:00
parent ba68e1799d
commit 21b6aa1e81
2 changed files with 3 additions and 10 deletions

View file

@ -3,6 +3,6 @@ require 'spec_helper'
describe Mutant, 'as a zombie' do describe Mutant, 'as a zombie' do
specify 'allows to create zombie from mutant' do specify 'allows to create zombie from mutant' do
Zombie.setup Zombie.setup
Zombie::Loader # constant created from zombie creation Zombie::Runner
end end
end end

View file

@ -1,18 +1,11 @@
module Zombie module Zombie
class Loader
module MethodObject
end
end
class Matcher
end
def self.setup def self.setup
return if defined?(@done) return if defined?(@done)
files.each do |path| files.each do |path|
path = "#{File.expand_path(path, root)}.rb" path = "#{File.expand_path(path, root)}.rb"
ast = File.read(path).to_ast ast = File.read(path).to_ast
zombify(ast, path) zombify(ast, path)
ToSource.to_source(ast.body)
end end
@done = true @done = true
end end
@ -59,7 +52,7 @@ module Zombie
# For some reason loading is not the same as eval...? # For some reason loading is not the same as eval...?
# eval(root.to_source) # eval(root.to_source)
Mutant::Loader.run(script) ::Mutant::Loader.run(script)
end end
private_class_method :zombify private_class_method :zombify