From 22ac0c8d564f421db4e7f97df585f801a391a76e Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Fri, 4 Sep 2015 20:20:56 +0000 Subject: [PATCH] Update anima to ~0.3.0 --- config/flay.yml | 2 +- lib/mutant/cli.rb | 22 +++++++++---------- lib/mutant/config.rb | 2 +- lib/mutant/env.rb | 2 +- lib/mutant/matcher/config.rb | 4 ++-- lib/mutant/parallel.rb | 4 ++-- lib/mutant/result.rb | 2 +- lib/mutant/runner/sink.rb | 2 +- mutant.gemspec | 4 ++-- spec/spec_helper.rb | 2 +- spec/support/shared_context.rb | 10 ++++----- spec/unit/mutant/cli_spec.rb | 6 ++--- spec/unit/mutant/env/boostrap_spec.rb | 6 ++--- spec/unit/mutant/env_spec.rb | 2 +- spec/unit/mutant/matcher/compiler_spec.rb | 2 +- spec/unit/mutant/parallel/master_spec.rb | 4 ++-- .../reporter/cli/printer/config_spec.rb | 2 +- .../reporter/cli/printer/env_progress_spec.rb | 6 ++--- .../reporter/cli/printer/env_result_spec.rb | 2 +- .../printer/mutation_progress_result_spec.rb | 4 ++-- .../cli/printer/mutation_result_spec.rb | 6 ++--- .../cli/printer/status_progressive_spec.rb | 10 ++++----- .../reporter/cli/printer/status_spec.rb | 10 ++++----- .../cli/printer/subject_progress_spec.rb | 4 ++-- .../cli/printer/subject_result_spec.rb | 4 ++-- spec/unit/mutant/reporter/cli_spec.rb | 10 +++++---- spec/unit/mutant/runner/sink/mutation_spec.rb | 16 +++++++------- spec/unit/mutant/selector/expression_spec.rb | 2 +- 28 files changed, 77 insertions(+), 75 deletions(-) diff --git a/config/flay.yml b/config/flay.yml index 961789d7a..51bf86876 100644 --- a/config/flay.yml +++ b/config/flay.yml @@ -1,3 +1,3 @@ --- threshold: 18 -total_score: 1223 +total_score: 1234 diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 97bca13ff..4aeea71df 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -98,7 +98,7 @@ def parse_match_expressions(expressions) def add_environment_options(opts) opts.separator('Environment:') opts.on('--zombie', 'Run mutant zombified') do - update(zombie: true) + with(zombie: true) end opts.on('-I', '--include DIRECTORY', 'Add DIRECTORY to $LOAD_PATH') do |directory| add(:includes, directory) @@ -107,7 +107,7 @@ def add_environment_options(opts) add(:requires, name) end opts.on('-j', '--jobs NUMBER', 'Number of kill jobs. Defaults to number of processors.') do |number| - update(jobs: Integer(number)) + with(jobs: Integer(number)) end end @@ -119,7 +119,7 @@ def add_environment_options(opts) # # @api private def setup_integration(name) - update(integration: Integration.setup(name)) + with(integration: Integration.setup(name)) rescue LoadError raise Error, "Could not load integration #{name.inspect} (you may want to try installing the gem mutant-#{name})" end @@ -139,7 +139,7 @@ def add_mutation_options(opts) '--expected-coverage COVERAGE', 'Fail unless COVERAGE is not reached exactly, parsed via Rational()' ) do |coverage| - update(expected_coverage: Rational(coverage)) + with(expected_coverage: Rational(coverage)) end opts.on('--use INTEGRATION', 'Use INTEGRATION to kill mutations', &method(:setup_integration)) end @@ -169,14 +169,14 @@ def add_filter_options(opts) # @api private def add_debug_options(opts) opts.on('--fail-fast', 'Fail fast') do - update(fail_fast: true) + with(fail_fast: true) end opts.on('--version', 'Print mutants version') do puts("mutant-#{VERSION}") Kernel.exit(EXIT_SUCCESS) end opts.on('-d', '--debug', 'Enable debugging output') do - update(debug: true) + with(debug: true) end opts.on_tail('-h', '--help', 'Show this message') do puts(opts.to_s) @@ -184,15 +184,15 @@ def add_debug_options(opts) end end - # Update configuration + # With configuration # # @param [Hash] attributes # # @return [undefined] # # @api private - def update(attributes) - @config = @config.update(attributes) + def with(attributes) + @config = @config.with(attributes) end # Add configuration @@ -207,7 +207,7 @@ def update(attributes) # # @api private def add(attribute, value) - update(attribute => config.public_send(attribute) + [value]) + with(attribute => config.public_send(attribute) + [value]) end # Add matcher configuration @@ -222,7 +222,7 @@ def add(attribute, value) # # @api private def add_matcher(attribute, value) - update(matcher: config.matcher.add(attribute, value)) + with(matcher: config.matcher.add(attribute, value)) end end # CLI diff --git a/lib/mutant/config.rb b/lib/mutant/config.rb index 7acf858d2..9d0e44609 100644 --- a/lib/mutant/config.rb +++ b/lib/mutant/config.rb @@ -4,7 +4,7 @@ module Mutant # Does not reference any "external" volatile state. The configuration applied # to current environment is being represented by the Mutant::Env object. class Config - include Adamantium::Flat, Anima::Update, Anima.new( + include Adamantium::Flat, Anima.new( :debug, :integration, :matcher, diff --git a/lib/mutant/env.rb b/lib/mutant/env.rb index 276481aa9..84d1b50e8 100644 --- a/lib/mutant/env.rb +++ b/lib/mutant/env.rb @@ -1,7 +1,7 @@ module Mutant # Abstract base class for mutant environments class Env - include Adamantium::Flat, Anima::Update, Anima.new( + include Adamantium::Flat, Anima.new( :config, :actor_env, :cache, diff --git a/lib/mutant/matcher/config.rb b/lib/mutant/matcher/config.rb index cac93d06f..082b63c15 100644 --- a/lib/mutant/matcher/config.rb +++ b/lib/mutant/matcher/config.rb @@ -2,7 +2,7 @@ module Mutant class Matcher # Subject matcher configuration class Config - include Adamantium, Anima::Update, Anima.new( + include Adamantium, Anima.new( :match_expressions, :ignore_expressions, :subject_filters @@ -41,7 +41,7 @@ def inspect # # @api private def add(attribute, value) - update(attribute => public_send(attribute) + [value]) + with(attribute => public_send(attribute) + [value]) end private diff --git a/lib/mutant/parallel.rb b/lib/mutant/parallel.rb index 84339e05b..a380f3d4d 100644 --- a/lib/mutant/parallel.rb +++ b/lib/mutant/parallel.rb @@ -75,12 +75,12 @@ class JobResult # Parallel run configuration class Config - include Anima::Update, Adamantium::Flat, Anima.new(:env, :processor, :source, :sink, :jobs) + include Adamantium::Flat, Anima.new(:env, :processor, :source, :sink, :jobs) end # Config # Parallel execution status class Status - include Adamantium::Flat, Anima::Update, Anima.new(:payload, :done, :active_jobs) + include Adamantium::Flat, Anima.new(:payload, :done, :active_jobs) end end # Parallel diff --git a/lib/mutant/result.rb b/lib/mutant/result.rb index 9105776d2..a7fdf3feb 100644 --- a/lib/mutant/result.rb +++ b/lib/mutant/result.rb @@ -67,7 +67,7 @@ def overhead # @api private def self.included(host) host.class_eval do - include Adamantium, Anima::Update + include Adamantium extend ClassMethods end end diff --git a/lib/mutant/runner/sink.rb b/lib/mutant/runner/sink.rb index 8b60768f0..6a7c2b02c 100644 --- a/lib/mutant/runner/sink.rb +++ b/lib/mutant/runner/sink.rb @@ -78,7 +78,7 @@ def result(mutation_result) original = @subject_results[mutation.subject] - @subject_results[mutation.subject] = original.update( + @subject_results[mutation.subject] = original.with( mutation_results: (original.mutation_results + [mutation_result]), tests: mutation_result.test_result.tests ) diff --git a/mutant.gemspec b/mutant.gemspec index 188997793..7146e8e67 100644 --- a/mutant.gemspec +++ b/mutant.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency('ast', '~> 2.1') gem.add_runtime_dependency('diff-lcs', '~> 1.2') gem.add_runtime_dependency('parallel', '~> 1.3') - gem.add_runtime_dependency('morpher', '~> 0.2.4') + gem.add_runtime_dependency('morpher', '~> 0.2.5') gem.add_runtime_dependency('procto', '~> 0.0.2') gem.add_runtime_dependency('abstract_type', '~> 0.0.7') gem.add_runtime_dependency('unparser', '~> 0.2.4') @@ -33,7 +33,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency('adamantium', '~> 0.2.0') gem.add_runtime_dependency('memoizable', '~> 0.4.2') gem.add_runtime_dependency('equalizer', '~> 0.0.9') - gem.add_runtime_dependency('anima', '~> 0.2.0') + gem.add_runtime_dependency('anima', '~> 0.3.0') gem.add_runtime_dependency('concord', '~> 0.1.5') gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 059ba4161..d69c02d7c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,7 +33,7 @@ require 'test_app' module Fixtures - TEST_CONFIG = Mutant::Config::DEFAULT.update(reporter: Mutant::Reporter::Trace.new) + TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Trace.new) TEST_CACHE = Mutant::Cache.new TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG, TEST_CACHE) end # Fixtures diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb index d1f5c9dc8..7b8ba8221 100644 --- a/spec/support/shared_context.rb +++ b/spec/support/shared_context.rb @@ -1,8 +1,8 @@ # rubocop:disable ModuleLength module SharedContext - def update(name, &block) + def with(name, &block) define_method(name) do - super().update(instance_eval(&block)) + super().with(instance_eval(&block)) end end @@ -51,7 +51,7 @@ def setup_shared_context end let(:config) do - Mutant::Config::DEFAULT.update( + Mutant::Config::DEFAULT.with( jobs: 1, reporter: Mutant::Reporter::Trace.new ) @@ -120,11 +120,11 @@ def setup_shared_context end let(:empty_subject_a_result) do - subject_a_result.update(mutation_results: []) + subject_a_result.with(mutation_results: []) end let(:partial_subject_a_result) do - subject_a_result.update(mutation_results: [mutation_a_result]) + subject_a_result.with(mutation_results: [mutation_a_result]) end end end diff --git a/spec/unit/mutant/cli_spec.rb b/spec/unit/mutant/cli_spec.rb index 6b35706ae..cee311765 100644 --- a/spec/unit/mutant/cli_spec.rb +++ b/spec/unit/mutant/cli_spec.rb @@ -73,7 +73,7 @@ let(:default_matcher_config) do Mutant::Matcher::Config::DEFAULT - .update(match_expressions: expressions.map(&method(:parse_expression))) + .with(match_expressions: expressions.map(&method(:parse_expression))) end let(:flags) { [] } @@ -235,7 +235,7 @@ let(:flags) { %w[--since master] } let(:expected_matcher_config) do - default_matcher_config.update( + default_matcher_config.with( subject_filters: [ Mutant::Repository::SubjectFilter.new(Mutant::Repository::Diff.new('HEAD', 'master')) ] @@ -249,7 +249,7 @@ let(:flags) { %w[--ignore-subject Foo::Bar] } let(:expected_matcher_config) do - default_matcher_config.update(ignore_expressions: [parse_expression('Foo::Bar')]) + default_matcher_config.with(ignore_expressions: [parse_expression('Foo::Bar')]) end it_should_behave_like 'a cli parser' diff --git a/spec/unit/mutant/env/boostrap_spec.rb b/spec/unit/mutant/env/boostrap_spec.rb index 916b781f2..0176d31f9 100644 --- a/spec/unit/mutant/env/boostrap_spec.rb +++ b/spec/unit/mutant/env/boostrap_spec.rb @@ -1,6 +1,6 @@ RSpec.describe Mutant::Env::Bootstrap do let(:config) do - Mutant::Config::DEFAULT.update( + Mutant::Config::DEFAULT.with( jobs: 1, reporter: Mutant::Reporter::Trace.new, includes: [], @@ -69,7 +69,7 @@ def name end context 'when includes are present' do - let(:config) { super().update(includes: %w[foo bar]) } + let(:config) { super().with(includes: %w[foo bar]) } before do %w[foo bar].each do |component| @@ -121,7 +121,7 @@ def name end let(:expected_env) do - super().update( + super().with( subjects: subjects, mutations: mutations ) diff --git a/spec/unit/mutant/env_spec.rb b/spec/unit/mutant/env_spec.rb index 3adf92084..73a0f9e84 100644 --- a/spec/unit/mutant/env_spec.rb +++ b/spec/unit/mutant/env_spec.rb @@ -16,7 +16,7 @@ let(:integration) { integration_class.new(config) } let(:config) do - Mutant::Config::DEFAULT.update(isolation: isolation, integration: integration_class) + Mutant::Config::DEFAULT.with(isolation: isolation, integration: integration_class) end let(:isolation) { double('Isolation') } diff --git a/spec/unit/mutant/matcher/compiler_spec.rb b/spec/unit/mutant/matcher/compiler_spec.rb index aa27897ec..d6898d30c 100644 --- a/spec/unit/mutant/matcher/compiler_spec.rb +++ b/spec/unit/mutant/matcher/compiler_spec.rb @@ -18,7 +18,7 @@ end describe '.call' do - subject { object.call(env, matcher_config.update(attributes)) } + subject { object.call(env, matcher_config.with(attributes)) } let(:matcher_config) { Mutant::Matcher::Config::DEFAULT } diff --git a/spec/unit/mutant/parallel/master_spec.rb b/spec/unit/mutant/parallel/master_spec.rb index 6c03a5e50..2a44eb505 100644 --- a/spec/unit/mutant/parallel/master_spec.rb +++ b/spec/unit/mutant/parallel/master_spec.rb @@ -92,8 +92,8 @@ def stop? subject { described_class.call(config) } context 'with multiple workers configured' do - let(:config) { super().update(jobs: 2) } - let(:expected_results) { [] } + let(:config) { super().with(jobs: 2) } + let(:expected_results) { [] } before do expect(Mutant::Parallel::Worker).to receive(:run).with( diff --git a/spec/unit/mutant/reporter/cli/printer/config_spec.rb b/spec/unit/mutant/reporter/cli/printer/config_spec.rb index 9d891452d..a61fc2131 100644 --- a/spec/unit/mutant/reporter/cli/printer/config_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/config_spec.rb @@ -17,7 +17,7 @@ end context 'with non default coverage expectation' do - update(:config) { { expected_coverage: 0.1r } } + with(:config) { { expected_coverage: 0.1r } } it_reports(<<-REPORT) Mutant configuration: diff --git a/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb b/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb index a67c83d05..e001fb9b8 100644 --- a/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb @@ -1,13 +1,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do setup_shared_context - update(:config) { { expected_coverage: 0.1r } } + with(:config) { { expected_coverage: 0.1r } } let(:reportable) { env_result } describe '.call' do context 'without progress' do - update(:subject_a_result) { { mutation_results: [] } } + with(:subject_a_result) { { mutation_results: [] } } it_reports <<-'STR' Mutant configuration: @@ -51,7 +51,7 @@ end context 'on partial coverage' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it_reports <<-'STR' Mutant configuration: diff --git a/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb index 2e22d1730..0d9db79bd 100644 --- a/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb @@ -1,7 +1,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvResult do setup_shared_context - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } let(:reportable) { env_result } diff --git a/spec/unit/mutant/reporter/cli/printer/mutation_progress_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/mutation_progress_result_spec.rb index e1f442b4c..0e31d0c14 100644 --- a/spec/unit/mutant/reporter/cli/printer/mutation_progress_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/mutation_progress_result_spec.rb @@ -9,13 +9,13 @@ describe '.run' do context 'on killed mutant' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it_reports Mutant::Color::RED.format('F') end context 'on alive mutant' do - update(:mutation_a_test_result) { { passed: false } } + with(:mutation_a_test_result) { { passed: false } } it_reports Mutant::Color::GREEN.format('.') end diff --git a/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb index 17f73a004..f1ffd86c2 100644 --- a/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb @@ -5,7 +5,7 @@ describe '.call' do context 'failed kill' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } context 'on evil mutation' do context 'with a diff' do @@ -61,7 +61,7 @@ end context 'on neutral mutation' do - update(:mutation_a_test_result) { { passed: false } } + with(:mutation_a_test_result) { { passed: false } } let(:mutation_a) do Mutant::Mutation::Neutral.new(subject_a, s(:true)) @@ -86,7 +86,7 @@ end context 'on noop mutation' do - update(:mutation_a_test_result) { { passed: false } } + with(:mutation_a_test_result) { { passed: false } } let(:mutation_a) do Mutant::Mutation::Noop.new(subject_a, s(:true)) diff --git a/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb b/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb index 834ba4d4d..77bd36852 100644 --- a/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb @@ -5,14 +5,14 @@ describe '.call' do context 'with empty scheduler' do - update(:env_result) { { subject_results: [] } } + with(:env_result) { { subject_results: [] } } it_reports <<-REPORT (00/02) 100% - killtime: 0.00s runtime: 4.00s overhead: 4.00s REPORT context 'on non default coverage expectation' do - update(:config) { { expected_coverage: 0.1r } } + with(:config) { { expected_coverage: 0.1r } } it_reports <<-REPORT (00/02) 100% - killtime: 0.00s runtime: 4.00s overhead: 4.00s @@ -22,7 +22,7 @@ context 'with scheduler active on one subject' do context 'without progress' do - update(:status) { { active_jobs: [].to_set } } + with(:status) { { active_jobs: [].to_set } } it_reports(<<-REPORT) (02/02) 100% - killtime: 2.00s runtime: 4.00s overhead: 2.00s @@ -30,10 +30,10 @@ end context 'with progress' do - update(:status) { { active_jobs: [job_b, job_a].to_set } } + with(:status) { { active_jobs: [job_b, job_a].to_set } } context 'on failure' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it_reports(<<-REPORT) (01/02) 50% - killtime: 2.00s runtime: 4.00s overhead: 2.00s diff --git a/spec/unit/mutant/reporter/cli/printer/status_spec.rb b/spec/unit/mutant/reporter/cli/printer/status_spec.rb index b1fb3574f..01e82b33e 100644 --- a/spec/unit/mutant/reporter/cli/printer/status_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/status_spec.rb @@ -5,7 +5,7 @@ describe '.call' do context 'with empty scheduler' do - update(:env_result) { { subject_results: [] } } + with(:env_result) { { subject_results: [] } } it_reports <<-REPORT Mutant configuration: @@ -28,7 +28,7 @@ REPORT context 'on non default coverage expectation' do - update(:config) { { expected_coverage: 0.1r } } + with(:config) { { expected_coverage: 0.1r } } it_reports <<-REPORT Mutant configuration: @@ -54,7 +54,7 @@ context 'with scheduler active on one subject' do context 'without progress' do - update(:status) { { active_jobs: [].to_set } } + with(:status) { { active_jobs: [].to_set } } it_reports(<<-REPORT) Mutant configuration: @@ -78,10 +78,10 @@ end context 'with progress' do - update(:status) { { active_jobs: [job_b, job_a].to_set } } + with(:status) { { active_jobs: [job_b, job_a].to_set } } context 'on failure' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it_reports(<<-REPORT) Mutant configuration: diff --git a/spec/unit/mutant/reporter/cli/printer/subject_progress_spec.rb b/spec/unit/mutant/reporter/cli/printer/subject_progress_spec.rb index 81ae96882..041ba1d4c 100644 --- a/spec/unit/mutant/reporter/cli/printer/subject_progress_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/subject_progress_spec.rb @@ -13,7 +13,7 @@ end context 'on partial coverage' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it_reports <<-'STR' subject-a mutations: 2 @@ -23,7 +23,7 @@ end context 'without results' do - update(:subject_a_result) { { mutation_results: [] } } + with(:subject_a_result) { { mutation_results: [] } } it_reports <<-'STR' subject-a mutations: 2 diff --git a/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb index 54e90c4c3..a0525282c 100644 --- a/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb @@ -12,7 +12,7 @@ end context 'on partial coverage' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it_reports <<-'STR' subject-a @@ -26,7 +26,7 @@ end context 'without results' do - update(:subject_a_result) { { mutation_results: [] } } + with(:subject_a_result) { { mutation_results: [] } } it_reports <<-'STR' subject-a diff --git a/spec/unit/mutant/reporter/cli_spec.rb b/spec/unit/mutant/reporter/cli_spec.rb index eb99dbf84..d7137708f 100644 --- a/spec/unit/mutant/reporter/cli_spec.rb +++ b/spec/unit/mutant/reporter/cli_spec.rb @@ -132,7 +132,8 @@ def self.it_reports(expected_content) context 'with non default coverage expectation' do let(:format) { progressive_format } - update(:config) { { expected_coverage: 0.1r } } + + with(:config) { { expected_coverage: 0.1r } } it_reports(<<-REPORT) Mutant configuration: @@ -204,7 +205,7 @@ def self.it_reports(expected_content) let(:format) { progressive_format } context 'with empty scheduler' do - update(:env_result) { { subject_results: [] } } + with(:env_result) { { subject_results: [] } } let(:tty?) { true } @@ -212,14 +213,15 @@ def self.it_reports(expected_content) end context 'with last mutation present' do - update(:env_result) { { subject_results: [subject_a_result] } } + with(:env_result) { { subject_results: [subject_a_result] } } context 'when mutation is successful' do it_reports "(02/02) 100% - killtime: 2.00s runtime: 4.00s overhead: 2.00s\n" end context 'when mutation is NOT successful' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } + it_reports "(01/02) 50% - killtime: 2.00s runtime: 4.00s overhead: 2.00s\n" end end diff --git a/spec/unit/mutant/runner/sink/mutation_spec.rb b/spec/unit/mutant/runner/sink/mutation_spec.rb index 7607daded..ca46cb5b7 100644 --- a/spec/unit/mutant/runner/sink/mutation_spec.rb +++ b/spec/unit/mutant/runner/sink/mutation_spec.rb @@ -52,7 +52,7 @@ context 'one result' do include_context 'one result' - update(:subject_a_result) { { mutation_results: [mutation_a_result] } } + with(:subject_a_result) { { mutation_results: [mutation_a_result] } } let(:expected_status) do Mutant::Result::Env.new(env: env, runtime: 0.0, subject_results: [subject_a_result]) @@ -88,7 +88,7 @@ end context 'when result failed' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it { should be(false) } end @@ -102,13 +102,13 @@ end context 'when first result is unsuccessful' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it { should be(false) } end context 'when second result is unsuccessful' do - update(:mutation_b_test_result) { { passed: true } } + with(:mutation_b_test_result) { { passed: true } } it { should be(false) } end @@ -116,7 +116,7 @@ end context 'with fail fast' do - update(:config) { { fail_fast: true } } + with(:config) { { fail_fast: true } } context 'no results' do it { should be(false) } @@ -130,7 +130,7 @@ end context 'when result failed' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it { should be(true) } end @@ -144,13 +144,13 @@ end context 'when first result is unsuccessful' do - update(:mutation_a_test_result) { { passed: true } } + with(:mutation_a_test_result) { { passed: true } } it { should be(true) } end context 'when second result is unsuccessful' do - update(:mutation_b_test_result) { { passed: true } } + with(:mutation_b_test_result) { { passed: true } } it { should be(true) } end diff --git a/spec/unit/mutant/selector/expression_spec.rb b/spec/unit/mutant/selector/expression_spec.rb index 6e415d4fa..71aabb395 100644 --- a/spec/unit/mutant/selector/expression_spec.rb +++ b/spec/unit/mutant/selector/expression_spec.rb @@ -19,7 +19,7 @@ let(:mutation_subject) { subject_class.new(context, node) } let(:context) { double('Context') } let(:node) { double('Node') } - let(:config) { Mutant::Config::DEFAULT.update(integration: integration) } + let(:config) { Mutant::Config::DEFAULT.with(integration: integration) } let(:integration) { double('Integration', all_tests: all_tests) } let(:test_a) { double('test a', expression: parse_expression('SubjectA')) } let(:test_b) { double('test b', expression: parse_expression('SubjectB')) }