Sha256: 03666d60feda0a2505f48a883a86584307c1c9eaf2df75ea8fa6ed1f5c45340f

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

RSpec.shared_examples_for 'framework integration' do
  def system_with_gemfile(*command)
    Kernel.system({ 'BUNDLE_GEMFILE' => gemfile }, *command)
  end

  around do |example|
    Bundler.with_clean_env do
      Dir.chdir(TestApp.root) do
        Kernel.system('bundle', 'install', '--gemfile', gemfile) || fail('Bundle install failed!')
        example.run
      end
    end
  end

  specify 'it allows to kill mutations' do
    expect(system_with_gemfile("#{base_cmd} TestApp::Literal#string")).to be(true)
  end

  specify 'it allows to exclude mutations' do
    cli = <<-CMD.split("\n").join(' ')
      #{base_cmd}
      --ignore-subject TestApp::Literal#uncovered_string
      --
      TestApp::Literal#string
      TestApp::Literal#uncovered_string
    CMD
    expect(system_with_gemfile(cli)).to be(true)
  end

  specify 'fails to kill mutations when they are not covered' do
    cli = "#{base_cmd} TestApp::Literal#uncovered_string"
    expect(system_with_gemfile(cli)).to be(false)
  end

  specify 'fails when some mutations are not covered' do
    cli = "#{base_cmd} TestApp::Literal"
    expect(system_with_gemfile(cli)).to be(false)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.8.24 spec/shared/framework_integration_behavior.rb
mutant-0.8.23 spec/shared/framework_integration_behavior.rb
mutant-0.8.22 spec/shared/framework_integration_behavior.rb
mutant-0.8.21 spec/shared/framework_integration_behavior.rb
mutant-0.8.20 spec/shared/framework_integration_behavior.rb