Skip to content

Commit

Permalink
Fix ignore pattern merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mbj committed Dec 2, 2023
1 parent 997a404 commit 049a11b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/mutant/mutation/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Config

def merge(other)
with(
ignore_patterns: other.ignore_patterns,
ignore_patterns: other.ignore_patterns.any? ? other.ignore_patterns : ignore_patterns,
operators: other.operators || operators,
timeout: other.timeout || timeout
)
Expand Down
19 changes: 15 additions & 4 deletions spec/unit/mutant/mutation/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ def expect_value(value)

context 'ignore patterns' do
let(:key) { :ignore_patterns }
let(:original_value) { :original }
let(:other_value) { :other }
let(:original_value) { %i[original] }

it 'returns other value' do
expect(apply.ignore_patterns).to be(:other)
context 'when other has ignore patterns' do
let(:other_value) { %i[other] }

it 'returns other value' do
expect(apply.ignore_patterns).to eql(%i[other])
end
end

context 'when other has no ignore patterns' do
let(:other_value) { [] }

it 'returns other value' do
expect(apply.ignore_patterns).to eql(%i[original])
end
end
end

Expand Down

0 comments on commit 049a11b

Please sign in to comment.