spec/changelog_spec.rb in danger-changelog-0.7.0 vs spec/changelog_spec.rb in danger-changelog-0.7.1

- old
+ new

@@ -22,12 +22,11 @@ changelog.check! end context 'without CHANGELOG changes' do before do - allow(changelog.git).to receive(:modified_files).and_return(['some-file.txt']) - allow(changelog.git).to receive(:added_files).and_return(['some-file.txt']) + allow(changelog.git).to receive_messages(modified_files: ['some-file.txt'], added_files: ['some-file.txt']) end it 'complains when no CHANGELOG can be found' do expect(subject).to be false expect(status_report[:errors]).to eq [] @@ -36,12 +35,11 @@ end end context 'with CHANGELOG changes' do before do - allow(changelog.git).to receive(:modified_files).and_return([changelog.filename]) - allow(changelog.git).to receive(:added_files).and_return([]) + allow(changelog.git).to receive_messages(modified_files: [changelog.filename], added_files: []) end it 'has no complaints' do expect(subject).to be true expect(status_report[:errors]).to eq [] @@ -57,12 +55,11 @@ end context 'without CHANGELOG changes' do context 'when something was modified' do before do - allow(changelog.git).to receive(:modified_files).and_return(['some-file.txt']) - allow(changelog.git).to receive(:added_files).and_return(['another-file.txt']) + allow(changelog.git).to receive_messages(modified_files: ['some-file.txt'], added_files: ['another-file.txt']) end it 'complains when no CHANGELOG can be found' do expect(subject).to be false expect(status_report[:errors]).to eq [] @@ -71,13 +68,13 @@ end end context 'with a README.md' do before do - allow(changelog.git).to receive(:modified_files).and_return(['README.md']) - allow(changelog.git).to receive(:added_files).and_return([]) + allow(changelog.git).to receive_messages(modified_files: ['README.md'], added_files: []) end + it 'has no complaints' do expect(subject).to be true expect(status_report[:errors]).to eq [] expect(status_report[:warnings]).to eq [] expect(status_report[:markdowns]).to eq [] @@ -86,26 +83,25 @@ context 'with files being ignored' do context 'name' do before do changelog.ignore_files = ['WHATEVER.md'] - allow(changelog.git).to receive(:modified_files).and_return(['WHATEVER.md']) - allow(changelog.git).to receive(:added_files).and_return([]) + allow(changelog.git).to receive_messages(modified_files: ['WHATEVER.md'], added_files: []) end it 'has no complaints' do expect(subject).to be true expect(status_report[:errors]).to eq [] expect(status_report[:warnings]).to eq [] expect(status_report[:markdowns]).to eq [] end end + context 'mixed' do before do changelog.ignore_files = ['WHATEVER.md', /\.txt$/] - allow(changelog.git).to receive(:modified_files).and_return(['WHATEVER.md']) - allow(changelog.git).to receive(:added_files).and_return(['one.txt', 'two.txt']) + allow(changelog.git).to receive_messages(modified_files: ['WHATEVER.md'], added_files: ['one.txt', 'two.txt']) end it 'has no complaints' do expect(subject).to be true expect(status_report[:errors]).to eq [] @@ -116,12 +112,11 @@ end end context 'with a new CHANGELOG' do before do - allow(changelog.git).to receive(:modified_files).and_return([]) - allow(changelog.git).to receive(:added_files).and_return([changelog.filename]) + allow(changelog.git).to receive_messages(modified_files: [], added_files: [changelog.filename]) end it 'has no complaints' do expect(subject).to be true expect(status_report[:errors]).to eq [] @@ -130,11 +125,10 @@ end end context 'with CHANGELOG changes' do before do - allow(changelog.git).to receive(:modified_files).and_return([changelog.filename]) - allow(changelog.git).to receive(:added_files).and_return([]) + allow(changelog.git).to receive_messages(modified_files: [changelog.filename], added_files: []) end it 'has no complaints' do expect(subject).to be true expect(status_report[:errors]).to eq []