Sha256: 09fbe41fe6be8b7c9244d24926656c08eb73a41431d46ef1541d3e7db236f7c6

Contents?: true

Size: 823 Bytes

Versions: 6

Compression:

Stored size: 823 Bytes

Contents

require 'spec_helper'

describe Mutant::Loader::Eval, '.run' do

  subject { object.run(node, file, line) }

  let(:object) { described_class }
  let(:file)   { 'test.rb'       }
  let(:line)   { 1               }

  let(:source) do
    # This test case will blow up when not executed
    # under toplevel binding.
    <<-RUBY
      class SomeNamespace
        class Bar
          def some_method
          end
        end

        class SomeOther
          class Foo < Bar
          end
        end
      end
    RUBY
  end

  let(:node) do
    source.to_ast
  end

  it 'should load nodes into vm' do
    subject
    ::SomeNamespace::SomeOther::Foo
  end

  it 'should set file and line correctly' do
    subject
    ::SomeNamespace::Bar.instance_method(:some_method).source_location.should eql(['test.rb', 3])
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.2.12 spec/unit/mutant/loader/eval/class_methods/run_spec.rb
mutant-0.2.11 spec/unit/mutant/loader/eval/class_methods/run_spec.rb
mutant-0.2.9 spec/unit/mutant/loader/eval/class_methods/run_spec.rb
mutant-0.2.8 spec/unit/mutant/loader/eval/class_methods/run_spec.rb
mutant-0.2.7 spec/unit/mutant/loader/eval/class_methods/run_spec.rb
mutant-0.2.6 spec/unit/mutant/loader/eval/class_methods/run_spec.rb