Commit 813fd6f6 authored by Robert Speicher's avatar Robert Speicher

DRY up the specs for bin/changelog

parent 651bdd7c
...@@ -10,54 +10,38 @@ describe 'bin/changelog' do ...@@ -10,54 +10,38 @@ describe 'bin/changelog' do
expect(options.amend).to eq true expect(options.amend).to eq true
end end
it 'parses --force' do it 'parses --force and -f' do
options = described_class.parse(%w[foo --force bar]) %w[--force -f].each do |flag|
options = described_class.parse(%W[foo #{flag} bar])
expect(options.force).to eq true expect(options.force).to eq true
end
end end
it 'parses -f' do it 'parses --merge-request and -m' do
options = described_class.parse(%w[foo -f bar]) %w[--merge-request -m].each do |flag|
options = described_class.parse(%W[foo #{flag} 1234 bar])
expect(options.force).to eq true expect(options.merge_request).to eq 1234
end
end end
it 'parses --merge-request' do it 'parses --dry-run and -n' do
options = described_class.parse(%w[foo --merge-request 1234 bar]) %w[--dry-run -n].each do |flag|
options = described_class.parse(%W[foo #{flag} bar])
expect(options.merge_request).to eq 1234 expect(options.dry_run).to eq true
end
end end
it 'parses -m' do it 'parses --git-username and -u' do
options = described_class.parse(%w[foo -m 4321 bar])
expect(options.merge_request).to eq 4321
end
it 'parses --dry-run' do
options = described_class.parse(%w[foo --dry-run bar])
expect(options.dry_run).to eq true
end
it 'parses -n' do
options = described_class.parse(%w[foo -n bar])
expect(options.dry_run).to eq true
end
it 'parses --git-username' do
allow(described_class).to receive(:git_user_name).and_return('Jane Doe') allow(described_class).to receive(:git_user_name).and_return('Jane Doe')
options = described_class.parse(%w[foo --git-username bar])
expect(options.author).to eq 'Jane Doe'
end
it 'parses -u' do %w[--git-username -u].each do |flag|
allow(described_class).to receive(:git_user_name).and_return('John Smith') options = described_class.parse(%W[foo #{flag} bar])
options = described_class.parse(%w[foo -u bar])
expect(options.author).to eq 'John Smith' expect(options.author).to eq 'Jane Doe'
end
end end
it 'parses -h' do it 'parses -h' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment