From a02756e0ca50613d89df69d537d8bfa763351e50 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Fri, 3 Aug 2012 01:38:35 +0200 Subject: [PATCH] Remove duplication in boolean mutator --- lib/mutant/mutator/literal/boolean.rb | 30 ++++--------------- .../mutation_spec.rb} | 0 2 files changed, 5 insertions(+), 25 deletions(-) rename spec/unit/mutant/mutator/literal/{boolean_spec.rb => boolean/mutation_spec.rb} (100%) diff --git a/lib/mutant/mutator/literal/boolean.rb b/lib/mutant/mutator/literal/boolean.rb index 2b2bdf06..a2d640f5 100644 --- a/lib/mutant/mutator/literal/boolean.rb +++ b/lib/mutant/mutator/literal/boolean.rb @@ -23,43 +23,23 @@ module Mutant # # @api private # - abstract_method :inverse + def inverse + new(self.class::INVERSE_CLASS) + end # Represent mutations of true literal class TrueLiteral < Boolean + INVERSE_CLASS = Rubinius::AST::FalseLiteral handle(Rubinius::AST::TrueLiteral) - - private - - # Return inverse - # - # @return [Rubinius::AST::FalseLiteral] - # - # @api private - # - def inverse - new(Rubinius::AST::FalseLiteral) - end end # Represent mutations of false literal class FalseLiteral < Boolean + INVERSE_CLASS = Rubinius::AST::TrueLiteral handle(Rubinius::AST::FalseLiteral) - - private - - # Return inverse class - # - # @return [Rubinius::AST::TrueLiteral] - # - # @api private - # - def inverse - new(Rubinius::AST::TrueLiteral) - end end end end diff --git a/spec/unit/mutant/mutator/literal/boolean_spec.rb b/spec/unit/mutant/mutator/literal/boolean/mutation_spec.rb similarity index 100% rename from spec/unit/mutant/mutator/literal/boolean_spec.rb rename to spec/unit/mutant/mutator/literal/boolean/mutation_spec.rb