free_mutant/spec/unit/mutant/loader/eval_spec.rb

49 lines
880 B
Ruby
Raw Normal View History

# encoding: utf-8
require 'spec_helper'
describe Mutant::Loader::Eval, '.call' do
subject { object.call(node, mutation_subject) }
let(:object) { described_class }
let(:path) { __FILE__ }
let(:line) { 1 }
let(:mutation_subject) do
2013-09-08 16:12:23 -04:00
double('Subject', source_path: path, source_line: line)
end
let(:source) do
<<-RUBY
class SomeNamespace
class Bar
def some_method
end
end
class SomeOther
class Foo < Bar
end
end
end
RUBY
end
let(:node) do
parse(source)
end
it 'should load nodes into vm' do
subject
::SomeNamespace::SomeOther::Foo
end
it 'should set file and line correctly' do
subject
2014-01-19 15:42:21 -05:00
expect(::SomeNamespace::Bar
.instance_method(:some_method)
2014-01-19 15:42:21 -05:00
.source_location).to eql([__FILE__, 3])
end
end