From 15376e6314ac632c9717da9a088d3a6172c94597 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sat, 20 Apr 2013 21:10:14 +0200 Subject: [PATCH] Equalize CLI on generated config object --- lib/mutant/cli.rb | 4 ++-- spec/unit/mutant/cli/class_methods/new_spec.rb | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 162bdaca..5f44fd68 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -2,7 +2,7 @@ module Mutant # Comandline parser class CLI < CLIParser - include Adamantium::Flat, Equalizer.new(:matcher, :filter, :strategy, :reporter) + include Adamantium::Flat, Equalizer.new(:config) # Run cli with arguments # @@ -113,7 +113,7 @@ module Mutant # @api private # def reporter - Mutant::Reporter::CLI.new(self) + Mutant::Reporter::CLI.new($stdout) end memoize :reporter diff --git a/spec/unit/mutant/cli/class_methods/new_spec.rb b/spec/unit/mutant/cli/class_methods/new_spec.rb index bf04ff9f..72c99a7e 100644 --- a/spec/unit/mutant/cli/class_methods/new_spec.rb +++ b/spec/unit/mutant/cli/class_methods/new_spec.rb @@ -7,6 +7,7 @@ shared_examples_for 'an invalid cli run' do end shared_examples_for 'a cli parser' do + subject { cli.config } its(:filter) { should eql(expected_filter) } its(:strategy) { should eql(expected_strategy.new(subject)) } its(:reporter) { should eql(expected_reporter) } @@ -25,9 +26,11 @@ describe Mutant::CLI, '.new' do # Defaults let(:expected_filter) { Mutant::Mutation::Filter::ALL } let(:expected_strategy) { Mutant::Strategy::Rspec::Unit } - let(:expected_reporter) { Mutant::Reporter::CLI.new($stderr) } + let(:expected_reporter) { Mutant::Reporter::CLI.new($stdout) } - subject { object.new(arguments) } + let(:cli) { object.new(arguments) } + + subject { cli } context 'with unknown flag' do let(:arguments) { %w(--invalid) } @@ -71,7 +74,6 @@ describe Mutant::CLI, '.new' do let(:expected_matcher) { Mutant::CLI::Classifier::Method.new('TestApp::Literal#float') } it_should_behave_like 'a cli parser' - end context 'with namespace matcher' do