summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-01-18 12:02:44 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-01-18 12:07:19 +0100
commit53f4f849956e10ccbbf4a9011b46b84da33129b0 (patch)
treeba1e9d8d52e64b26b07b5c7eba80f94f5e79b1a9 /spec/models
parent2e088c06d1ebb5f33469da0eb07664cd170207cc (diff)
downloadgitlab-ce-53f4f849956e10ccbbf4a9011b46b84da33129b0.tar.gz
Add URL validations for generic commit statuses
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/generic_commit_status_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/models/generic_commit_status_spec.rb b/spec/models/generic_commit_status_spec.rb
index b17d7cfe94c..f4c3e6d503f 100644
--- a/spec/models/generic_commit_status_spec.rb
+++ b/spec/models/generic_commit_status_spec.rb
@@ -10,6 +10,13 @@ describe GenericCommitStatus, models: true do
target_url: external_url)
end
+ describe 'validations' do
+ it { is_expected.to validate_length_of(:target_url).is_at_most(255) }
+ it { is_expected.to allow_value(nil).for(:target_url) }
+ it { is_expected.to allow_value('http://gitlab.com/s').for(:target_url) }
+ it { is_expected.not_to allow_value('javascript:alert(1)').for(:target_url) }
+ end
+
describe '#context' do
subject { generic_commit_status.context }
before { generic_commit_status.context = 'my_context' }