Commit 31245ea3 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rs-changelog-spec-dry' into 'master'

DRY up the bin/changelog specs

Depends on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7252

See merge request !7253
parents d636efbe 813fd6f6
...@@ -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
it 'parses -f' do
options = described_class.parse(%w[foo -f bar])
expect(options.force).to eq true
end end
it 'parses --merge-request' do it 'parses --merge-request and -m' do
options = described_class.parse(%w[foo --merge-request 1234 bar]) %w[--merge-request -m].each do |flag|
options = described_class.parse(%W[foo #{flag} 1234 bar])
expect(options.merge_request).to eq 1234 expect(options.merge_request).to eq 1234
end end
it 'parses -m' do
options = described_class.parse(%w[foo -m 4321 bar])
expect(options.merge_request).to eq 4321
end end
it 'parses --dry-run' do it 'parses --dry-run and -n' do
options = described_class.parse(%w[foo --dry-run bar]) %w[--dry-run -n].each do |flag|
options = described_class.parse(%W[foo #{flag} bar])
expect(options.dry_run).to eq true expect(options.dry_run).to eq true
end end
it 'parses -n' do
options = described_class.parse(%w[foo -n bar])
expect(options.dry_run).to eq true
end end
it 'parses --git-username' do it 'parses --git-username and -u' 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])
%w[--git-username -u].each do |flag|
options = described_class.parse(%W[foo #{flag} bar])
expect(options.author).to eq 'Jane Doe' expect(options.author).to eq 'Jane Doe'
end end
it 'parses -u' do
allow(described_class).to receive(:git_user_name).and_return('John Smith')
options = described_class.parse(%w[foo -u bar])
expect(options.author).to eq 'John Smith'
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