free_mutant/spec/shared/framework_integration_behavior.rb
Bartek Bułat 0be9fa75d6 Add Ruby 2.4 support for mutant
Several steps were made to achieve mutant working with Ruby 2.4 without
warnings and spec failures:

* Fix Fixnum deprecation warning
* Update RuboCop to 0.47 and fix offenses
* Relax version requirements on parser gem
* Update diff-lcs to 1.3
* Update rake 11.x -> 12.x
* Update reek 4.5 -> 4.6 (to work with parser 2.4)
* Update json 2.0 -> 2.1
* Update parallel 1.10 -> 1.11
* Update simplecov 0.12 -> 0.14
* Run regexp_parser integration against v0.4.3 (as we requiring this
    exact version)
* Update warnings.yml with new whitelist
* Run CircleCI tests on Ruby 2.3 and 2.4 (Bundler.with_clean_env
    was causing troubles on new CircleCI 2.0 setup, so it was removed)
2017-07-06 11:18:41 +02:00

36 lines
1.1 KiB
Ruby

RSpec.shared_examples_for 'framework integration' do
def system_with_gemfile(*command)
Kernel.system({ 'BUNDLE_GEMFILE' => gemfile }, *command)
end
around do |example|
Dir.chdir(TestApp.root) do
Kernel.system('bundle', 'install', '--gemfile', gemfile) || fail('Bundle install failed!')
example.run
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(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