diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2019-02-12 14:30:06 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2019-02-12 14:30:06 +0100 |
commit | ac9bb1a1be7458b981eca53cb82a79c4771e6077 (patch) | |
tree | 0aa4f34e186054e3fc358892c6b070f2840b2c10 | |
parent | 48c69146644c36fd85aecd399cd75994c09effb0 (diff) | |
download | gitlab-ce-57410-api-create-release-link-with-ftp-address-return-400-bad-request.tar.gz |
Use a parametrized spec57410-api-create-release-link-with-ftp-address-return-400-bad-request
Instead of repeating the tests, use a parametrized test. DRY
-rw-r--r-- | spec/models/releases/link_spec.rb | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/spec/models/releases/link_spec.rb b/spec/models/releases/link_spec.rb index 588c3845e10..4dd26c976cc 100644 --- a/spec/models/releases/link_spec.rb +++ b/spec/models/releases/link_spec.rb @@ -79,30 +79,20 @@ describe Releases::Link do end describe 'supported protocols' do - context 'for http' do - let(:link) { build(:release_link, url: 'http://assets.com/download') } - - it 'will be valid' do - expect(link).to be_valid - end + where(:protocol) do + %w(http https ftp) end - context 'for https' do - let(:link) { build(:release_link, url: 'https://assets.com/download') } - - it 'will be valid' do - expect(link).to be_valid - end - end - - context 'for ftp' do - let(:link) { build(:release_link, url: 'ftp://assets.com/download') } + with_them do + let(:link) { build(:release_link, url: protocol + '://assets.com/download') } it 'will be valid' do expect(link).to be_valid end end + end + describe 'unsupported protocol' do context 'for torrent' do let(:link) { build(:release_link, url: 'torrent://assets.com/download') } |