diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-07-26 10:35:47 +0300 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-07-29 14:54:45 +0300 |
commit | be9aa7f19474424991923f128053e2523fa166d8 (patch) | |
tree | dde83c7c92d7b932d3b9b79405fb1e5524034345 /spec/models/environment_spec.rb | |
parent | 242f8377264973d642b46e5d2800ef3d3bd4c0fa (diff) |
Add an URL field to Environments
This MR adds a string (thus max 255 chars) field to the enviroments
table to expose it later in other features.
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r-- | spec/models/environment_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 7629af6a570..6c11cfc4c9b 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -11,4 +11,14 @@ describe Environment, models: true do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name).scoped_to(:project_id) } it { is_expected.to validate_length_of(:name).is_within(0..255) } + + it { is_expected.to validate_length_of(:external_url).is_within(0..255) } + + # To circumvent a not null violation of the name column: + # https://github.com/thoughtbot/shoulda-matchers/issues/336 + it 'validates uniqueness of :external_url' do + create(:environment) + + is_expected.to validate_uniqueness_of(:external_url).scoped_to(:project_id) + end end |