a19f3b1691
* I do not use 1.9.3 * Also keeping them in each file increases mental overhead (true it *can* be autoamted) * None of the files encodes NON ASCII chars. * I do not expect it makes any difference, since nobody programmatically will consume strings generated by mutant under the assumption they are UTF-8 encoded. * 1.9.3 Users have to deal with the encoding fuckup under ruby anyways.
50 lines
959 B
Ruby
50 lines
959 B
Ruby
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
|
|
double('Subject', source_path: path, source_line: line)
|
|
end
|
|
|
|
before do
|
|
expect(mutation_subject).to receive(:prepare).and_return(mutation_subject)
|
|
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
|
|
expect(::SomeNamespace::Bar
|
|
.instance_method(:some_method)
|
|
.source_location).to eql([__FILE__, 3])
|
|
end
|
|
end
|