Sha256: 067a655ba150619719eeb4a05d36aad397618d9642cac55d9199f560264946a9

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

RSpec.describe Mutant::LineTrace do
  let(:object) { described_class }

  test_a_line = __LINE__ + 2
  def test_a
    test_b
  end

  test_b_line = __LINE__ + 2
  def test_b
  end

  test_c_line = __LINE__ + 2
  def test_c
  end

  shared_examples_for 'line trace' do
    it 'returns correct trace results' do
      expect(subject.cover?(__FILE__, test_a_line)).to be(true)
      expect(subject.cover?(__FILE__, test_b_line)).to be(true)
      expect(subject.cover?(__FILE__, test_c_line)).to be(false)
      expect(subject.cover?(__FILE__, __LINE__)).to be(false)
      expect(subject.cover?('/dev/null', test_a_line)).to be(false)
    end
  end

  describe '.cover?' do
    subject { object.call { test_a } }

    include_examples 'line trace'
  end

  describe '.call' do
    subject { object.call { test_a } }

    include_examples 'line trace'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutant-0.7.4 spec/unit/mutant/line_trace_spec.rb
mutant-0.7.3 spec/unit/mutant/line_trace_spec.rb
mutant-0.7.2 spec/unit/mutant/line_trace_spec.rb