diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 21:06:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 21:06:42 +0000 |
commit | d5e0416021aa6de53b89f9d415f368226d9326e5 (patch) | |
tree | 9a3e3bd6d1aac10cfde7f0079f784a489491a48b /spec/requests/api/settings_spec.rb | |
parent | 24fe7aa2aa199b2aace0cfec26d744f51d7e2167 (diff) | |
download | gitlab-ce-d5e0416021aa6de53b89f9d415f368226d9326e5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/settings_spec.rb')
-rw-r--r-- | spec/requests/api/settings_spec.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index f3bfb258029..ffaa29fd924 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -220,6 +220,54 @@ describe API::Settings, 'Settings' do end end + context "pendo tracking settings" do + let(:settings) do + { + pendo_url: "https://pendo.example.com", + pendo_enabled: true + } + end + + let(:attribute_names) { settings.keys.map(&:to_s) } + + it "includes the attributes in the API" do + get api("/application/settings", admin) + + expect(response).to have_gitlab_http_status(200) + attribute_names.each do |attribute| + expect(json_response.keys).to include(attribute) + end + end + + it "allows updating the settings" do + put api("/application/settings", admin), params: settings + + expect(response).to have_gitlab_http_status(200) + settings.each do |attribute, value| + expect(ApplicationSetting.current.public_send(attribute)).to eq(value) + end + end + + context "missing pendo_url value when pendo_enabled is true" do + it "returns a blank parameter error message" do + put api("/application/settings", admin), params: { pendo_enabled: true } + + expect(response).to have_gitlab_http_status(400) + expect(json_response["error"]).to eq("pendo_url is missing") + end + + it "handles validation errors" do + put api("/application/settings", admin), params: settings.merge({ + pendo_url: nil + }) + + expect(response).to have_gitlab_http_status(400) + message = json_response["message"] + expect(message["pendo_url"]).to include("can't be blank") + end + end + end + context "missing plantuml_url value when plantuml_enabled is true" do it "returns a blank parameter error message" do put api("/application/settings", admin), params: { plantuml_enabled: true } |