diff --git a/spec/unit/mutant/mutator/each_spec.rb b/spec/unit/mutant/mutator/each_spec.rb index 6fd4100d..ee44eed8 100644 --- a/spec/unit/mutant/mutator/each_spec.rb +++ b/spec/unit/mutant/mutator/each_spec.rb @@ -5,32 +5,6 @@ require 'spec_helper' describe Mutant::Mutator, '.each' do - context 'case statements' do - let(:source) { 'case self.condition; when true; true; when false; false; else raise; end' } - - let(:mutations) do - mutations = [] - - # Delete each when once - mutations << 'case self.condition; when true; true; else raise; end' - mutations << 'case self.condition; when false; false; else raise; end' - - # Mutate receiver - mutations << 'case condition; when true; true; when false; false; else raise; end' - - # Remove else branch - mutations << 'case self.condition; when true; true; when false; false; end' - - # Mutate when branch bodies - mutations << 'case self.condition; when true; nil; when false; false; else raise; end' - mutations << 'case self.condition; when true; false; when false; false; else raise; end' - mutations << 'case self.condition; when true; true; when false; nil; else raise; end' - mutations << 'case self.condition; when true; true; when false; true; else raise; end' - end - - it_should_behave_like 'a mutator' - end - pending 'interpolated string literal (DynamicString)' do let(:source) { '"foo#{1}bar"' } diff --git a/spec/unit/mutant/mutator/receiver_case/mutation_spec.rb b/spec/unit/mutant/mutator/receiver_case/mutation_spec.rb new file mode 100644 index 00000000..324f4130 --- /dev/null +++ b/spec/unit/mutant/mutator/receiver_case/mutation_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe Mutant::Mutator::ReceiverCase do + let(:source) { 'case self.condition; when true; true; when false; false; else raise; end' } + + let(:mutations) do + mutations = [] + + # Delete each when once + mutations << 'case self.condition; when true; true; else raise; end' + mutations << 'case self.condition; when false; false; else raise; end' + + # Mutate receiver + mutations << 'case condition; when true; true; when false; false; else raise; end' + + # Remove else branch + mutations << 'case self.condition; when true; true; when false; false; end' + + # Mutate when branch bodies + mutations << 'case self.condition; when true; nil; when false; false; else raise; end' + mutations << 'case self.condition; when true; false; when false; false; else raise; end' + mutations << 'case self.condition; when true; true; when false; nil; else raise; end' + mutations << 'case self.condition; when true; true; when false; true; else raise; end' + end + + it_should_behave_like 'a mutator' +end