991e561d49
* Only print config attributes that are present * This reduces noise for the user because he is not presented with meaningless information on configuration reports * This reduces the noise for the mutant developers as specs will be much more stable on future matcher config additions. Most of the specs that print a matcher config will not have to be altered when a new attribute is added.
36 lines
1.1 KiB
Ruby
36 lines
1.1 KiB
Ruby
RSpec.describe Mutant::Matcher::Config do
|
|
describe '#inspect' do
|
|
subject { object.inspect }
|
|
|
|
context 'on default config' do
|
|
let(:object) { described_class::DEFAULT }
|
|
|
|
it { should eql('#<Mutant::Matcher::Config empty>') }
|
|
end
|
|
|
|
context 'with one expression' do
|
|
let(:object) { described_class::DEFAULT.add(:match_expressions, parse_expression('Foo')) }
|
|
it { should eql('#<Mutant::Matcher::Config match_expressions: [Foo]>') }
|
|
end
|
|
|
|
context 'with many expressions' do
|
|
let(:object) do
|
|
described_class::DEFAULT
|
|
.add(:match_expressions, parse_expression('Foo'))
|
|
.add(:match_expressions, parse_expression('Bar'))
|
|
end
|
|
|
|
it { should eql('#<Mutant::Matcher::Config match_expressions: [Foo,Bar]>') }
|
|
end
|
|
|
|
context 'with match and ignore expression' do
|
|
let(:object) do
|
|
described_class::DEFAULT
|
|
.add(:match_expressions, parse_expression('Foo'))
|
|
.add(:ignore_expressions, parse_expression('Bar'))
|
|
end
|
|
|
|
it { should eql('#<Mutant::Matcher::Config match_expressions: [Foo] ignore_expressions: [Bar]>') }
|
|
end
|
|
end
|
|
end
|