Sha256: 3261e2384bb1ce6fa08cac5826fdeec38808c0c40dfdd882d461f0bb7f86813b

Contents?: true

Size: 844 Bytes

Versions: 9

Compression:

Stored size: 844 Bytes

Contents

RSpec.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

  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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutant-0.7.8 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.7 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.6 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.5 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.4 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.3 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.2 spec/unit/mutant/loader/eval_spec.rb
mutant-0.7.1 spec/unit/mutant/loader/eval_spec.rb
mutant-0.6.7 spec/unit/mutant/loader/eval_spec.rb