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 5808afe commit b82c2f8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# v0.11.26 unreleased

* [#1409](https://github.com/mbj/mutant/pull/1409)

Fix config file support for AST pattern ignores. Before this fix the AST ignore
patterns would only be picked up when specified via CLI.

* [#1405](https://github.com/mbj/mutant/pull/1406)

Drop support for ruby 2.7.
Expand Down
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 b82c2f8

Please sign in to comment.