spec/config_spec.rb in danger-changelog-0.7.0 vs spec/config_spec.rb in danger-changelog-0.7.1
- old
+ new
@@ -8,10 +8,11 @@
it 'defaults placeholder_line' do
expect(changelog.placeholder_line).to eq "* Your contribution here.\n"
end
end
+
context 'when without markdown star' do
before do
Danger::Changelog.config.placeholder_line = "Nothing yet.\n"
end
@@ -38,52 +39,64 @@
it 'saves configuration' do
expect(Danger::Changelog.config.placeholder_line).to eq "* Nothing yet.\n"
end
end
end
+
describe 'format' do
it 'default' do
expect(Danger::Changelog.config.format).to eq :intridea
end
+
it 'with an invalid format' do
expect { Danger::Changelog.config.format = :foobar }.to raise_error ArgumentError, 'Invalid format: foobar'
end
+
it 'with a string' do
- expect { Danger::Changelog.config.format = 'intridea' }.to_not raise_error
+ expect { Danger::Changelog.config.format = 'intridea' }.not_to raise_error
end
+
it 'with a symbol' do
- expect { Danger::Changelog.config.format = :intridea }.to_not raise_error
+ expect { Danger::Changelog.config.format = :intridea }.not_to raise_error
end
+
Danger::Changelog::Parsers::FORMATS.each_pair do |format, parser|
context format do
before do
Danger::Changelog.config.format = format
end
+
it 'sets format' do
expect(Danger::Changelog.config.format).to eq format
end
+
it 'creates parser' do
expect(Danger::Changelog.config.parser).to be_a parser
end
end
end
end
+
describe 'ignore_files' do
it 'default' do
expect(Danger::Changelog.config.ignore_files).to eq(['README.md'])
end
+
context 'with a file name' do
before do
Danger::Changelog.config.ignore_files = 'WHATEVER.md'
end
+
it 'transforms it into an array' do
expect(Danger::Changelog.config.ignore_files).to eq(['WHATEVER.md'])
end
end
+
context 'with multiple names' do
before do
Danger::Changelog.config.ignore_files = ['WHATEVER.md', /\*.md$/]
end
+
it 'transforms it into an array' do
expect(Danger::Changelog.config.ignore_files).to eq(['WHATEVER.md', /\*.md$/])
end
end
end