free_mutant/spec/unit/mutant/context/scope/root_spec.rb
Markus Schirp 6df5811a87 Use RSpec as receiver for rspec DSL methods
* I dislike the global infection RSpec does. This commit is a first step
  to get a rid of it.
* Also remove the need for `require 'spec_helper` in each spec file with
  adjusting `.rspec`.
2014-08-10 21:04:07 +00:00

32 lines
750 B
Ruby

RSpec.describe Mutant::Context::Scope, '#root' do
subject { object.root(node) }
let(:object) { described_class.new(TestApp::Literal, path) }
let(:path) { double('Path') }
let(:node) { parse(':node') }
let(:scope) { subject.body }
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
expect(generated_source).to eql(expected_source)
end
end