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

35 lines
763 B
Ruby
Raw Normal View History

require 'spec_helper'
describe Mutant::Context::Scope, '#root' do
subject { object.root(node) }
let(:object) { described_class.new(TestApp::Literal, path) }
let(:path) { double('Path') }
2013-06-25 03:37:45 -04:00
let(:node) { parse(':node') }
let(:scope) { subject.body }
2013-06-25 03:37:45 -04:00
let(:scope_body) { scope.body }
let(:expected_source) do
generate(parse(<<-RUBY))
module TestApp
class Literal
:node
end
end
RUBY
end
let(:generated_source) do
Unparser.unparse(subject)
end
let(:round_tripped_source) do
Unparser.unparse(parse(expected_source))
end
it 'should create correct source' do
generated_source.should eql(expected_source)
end
end