Sha256: 573d0935aaac3cde3013d31fc9c7608977dca894ad90d8ba2d6a54d6753315dd

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Mutant, 'rspec integration' do

  let(:base_cmd) { 'bundle exec mutant -I lib --require test_app --use rspec' }

  shared_examples_for 'rspec integration' do
    around do |example|
      Bundler.with_clean_env do
        Dir.chdir(TestApp.root) do
          Kernel.system("bundle install --gemfile=#{gemfile}")
          ENV['BUNDLE_GEMFILE'] = gemfile
          example.run
        end
      end
    end

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

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

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

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

  context 'RSpec 2' do
    let(:gemfile) { 'Gemfile.rspec2' }

    it_behaves_like 'rspec integration'
  end

  context 'Rspec 3' do
    let(:gemfile) { 'Gemfile.rspec3' }

    it_behaves_like 'rspec integration'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.5.10 spec/integration/mutant/rspec_spec.rb
mutant-0.5.9 spec/integration/mutant/rspec_spec.rb
mutant-0.5.8 spec/integration/mutant/rspec_spec.rb
mutant-0.5.7 spec/integration/mutant/rspec_spec.rb
mutant-0.5.6 spec/integration/mutant/rspec_spec.rb
mutant-0.5.5 spec/integration/mutant/rspec_spec.rb
mutant-0.5.4 spec/integration/mutant/rspec_spec.rb