Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Pereira <rpereira@gitlab.com>2019-01-07 20:55:21 +0300
committerSean McGivern <sean@gitlab.com>2019-01-07 20:55:21 +0300
commitf40b5860d76a8ea5d964260834a6e83516b0f1fd (patch)
tree2a8e92896130697178f5c989e49fa686f66ce073 /spec/models/error_tracking/project_error_tracking_setting_spec.rb
parent549ee8ada3b59278871a89720632584bc5cc11df (diff)
Add table and model for error tracking settings
Diffstat (limited to 'spec/models/error_tracking/project_error_tracking_setting_spec.rb')
-rw-r--r--spec/models/error_tracking/project_error_tracking_setting_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
new file mode 100644
index 00000000000..83f29718eda
--- /dev/null
+++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ErrorTracking::ProjectErrorTrackingSetting do
+ set(:project) { create(:project) }
+
+ describe 'Associations' do
+ it { is_expected.to belong_to(:project) }
+ end
+
+ describe 'Validations' do
+ subject { create(:project_error_tracking_setting, project: project) }
+
+ context 'when api_url is over 255 chars' do
+ before do
+ subject.api_url = 'https://' + 'a' * 250
+ end
+
+ it 'fails validation' do
+ expect(subject).not_to be_valid
+ expect(subject.errors.messages[:api_url]).to include('is too long (maximum is 255 characters)')
+ end
+ end
+
+ context 'With unsafe url' do
+ let(:project_error_tracking_setting) { create(:project_error_tracking_setting, project: project) }
+
+ it 'fails validation' do
+ project_error_tracking_setting.api_url = "https://replaceme.com/'><script>alert(document.cookie)</script>"
+
+ expect(project_error_tracking_setting).not_to be_valid
+ end
+ end
+ end
+end