2012-07-27 00:24:11 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2012-08-10 20:23:39 +02:00
|
|
|
class CodeLoadingSubject
|
|
|
|
def x
|
|
|
|
true
|
2012-07-27 00:24:11 +02:00
|
|
|
end
|
2012-08-10 20:23:39 +02:00
|
|
|
end
|
2012-07-27 00:24:11 +02:00
|
|
|
|
2012-08-10 20:23:39 +02:00
|
|
|
describe Mutant, 'code loading' do
|
2012-08-16 04:10:54 +02: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-27 00:24:11 +02:00
|
|
|
|
2012-08-10 20:23:39 +02:00
|
|
|
before { subject }
|
2012-07-27 00:24:11 +02:00
|
|
|
|
2012-08-10 20:23:39 +02:00
|
|
|
it 'should add the method to subject' do
|
|
|
|
CodeLoadingSubject.new.foo.should be(:bar)
|
2012-07-27 00:24:11 +02:00
|
|
|
end
|
|
|
|
end
|