free_mutant/spec/unit/mutant/context/constant/root_spec.rb

27 lines
732 B
Ruby
Raw Normal View History

require 'spec_helper'
describe Mutant::Context::Constant, '#root' do
subject { object.root(node) }
2012-08-14 12:26:56 +02:00
let(:object) { described_class.build(path, TestApp::Literal) }
let(:path) { mock('Path') }
let(:node) { mock('Node') }
let(:constant) { subject.body }
let(:scope) { constant.body }
let(:scope_body) { scope.body }
it { should be_a(Rubinius::AST::Script) }
2012-08-14 12:26:56 +02:00
its(:file) { should be(path) }
it 'should wrap the ast under constant' do
2012-08-14 12:26:56 +02:00
scope.should be_kind_of(Rubinius::AST::ClassScope)
end
it 'should place the ast under scope inside of block' do
scope_body.should be_a(Rubinius::AST::Block)
scope_body.array.should eql([node])
scope_body.array.first.should be(node)
end
end