summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-11-02 22:21:12 +0000
committerRobert Speicher <rspeicher@gmail.com>2016-11-03 17:35:06 +0000
commit813fd6f67531a0a9f9d072f18315d2ed43526de4 (patch)
treeb8660343acdb251ab27dd2a8f34ba6b6efdb208e
parent651bdd7c34c9ebf686b8357d8fc3ca4d0a58792e (diff)
downloadgitlab-ce-813fd6f67531a0a9f9d072f18315d2ed43526de4.tar.gz
DRY up the specs for bin/changelogrs-changelog-spec-dry
-rw-r--r--spec/bin/changelog_spec.rb56
1 files changed, 20 insertions, 36 deletions
diff --git a/spec/bin/changelog_spec.rb b/spec/bin/changelog_spec.rb
index 8c8bc1b0f1c..7f4298db59f 100644
--- a/spec/bin/changelog_spec.rb
+++ b/spec/bin/changelog_spec.rb
@@ -10,54 +10,38 @@ describe 'bin/changelog' do
expect(options.amend).to eq true
end
- it 'parses --force' do
- options = described_class.parse(%w[foo --force bar])
+ it 'parses --force and -f' do
+ %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])
+ it 'parses --merge-request and -m' do
+ %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
- it 'parses --merge-request' do
- options = described_class.parse(%w[foo --merge-request 1234 bar])
+ it 'parses --dry-run and -n' do
+ %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
- it 'parses -m' 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
+ it 'parses --git-username and -u' do
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
- allow(described_class).to receive(:git_user_name).and_return('John Smith')
- options = described_class.parse(%w[foo -u bar])
+ %w[--git-username -u].each do |flag|
+ options = described_class.parse(%W[foo #{flag} bar])
- expect(options.author).to eq 'John Smith'
+ expect(options.author).to eq 'Jane Doe'
+ end
end
it 'parses -h' do