2012-07-26 18:24:11 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2012-08-10 14:23:39 -04:00
|
|
|
class CodeLoadingSubject
|
|
|
|
def x
|
|
|
|
true
|
2012-07-26 18:24:11 -04:00
|
|
|
end
|
2012-08-10 14:23:39 -04:00
|
|
|
end
|
2012-07-26 18:24:11 -04:00
|
|
|
|
2012-08-10 14:23:39 -04:00
|
|
|
describe Mutant, 'code loading' do
|
2012-08-15 22:10:54 -04:00
|
|
|
let(:context) { Mutant::Context::Scope.build(CodeLoadingSubject,"/some/path") }
|
|
|
|
let(:node) { 'def foo; :bar; end'.to_ast }
|
|
|
|
let(:root) { context.root(node) }
|
|
|
|
|
|
|
|
subject { Mutant::Loader.run(root) }
|
2012-07-26 18:24:11 -04:00
|
|
|
|
2012-08-10 14:23:39 -04:00
|
|
|
before { subject }
|
2012-07-26 18:24:11 -04:00
|
|
|
|
2012-08-10 14:23:39 -04:00
|
|
|
it 'should add the method to subject' do
|
|
|
|
CodeLoadingSubject.new.foo.should be(:bar)
|
2012-07-26 18:24:11 -04:00
|
|
|
end
|
|
|
|
end
|