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:
authorAlex Lossent <alexandre.lossent@cern.ch>2015-10-13 12:29:57 +0300
committerAlex Lossent <alexandre.lossent@cern.ch>2015-10-14 16:27:59 +0300
commitb46397548056e4e8ef00efe4f641c61ba1dd5230 (patch)
tree1f5795dfdc3ef417dced3a797c0ec7e83551cf0e /spec/models/service_spec.rb
parent07101cfab61f28c6328efebea98f018ab8356cdd (diff)
Improve invalidation of stored service password if the endpoint URL is changed
It now allows to specify a password at the same time as the new URL, and works on the service template admin pages.
Diffstat (limited to 'spec/models/service_spec.rb')
-rw-r--r--spec/models/service_spec.rb39
1 files changed, 36 insertions, 3 deletions
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index da87ea5b84f..d42b96294ba 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -116,14 +116,47 @@ describe Service do
)
end
- it "returns false" do
+ it "returns false when the property has not been assigned a new value" do
service.username = "key_changed"
expect(service.prop_updated?(:bamboo_url)).to be_falsy
end
- it "returns true" do
- service.bamboo_url = "http://other.com"
+ it "returns true when the property has been assigned a different value" do
+ service.bamboo_url = "http://example.com"
expect(service.prop_updated?(:bamboo_url)).to be_truthy
end
+
+ it "returns true when the property has been re-assigned the same value" do
+ service.bamboo_url = 'http://gitlab.com'
+ expect(service.prop_updated?(:bamboo_url)).to be_truthy
+ end
+ end
+
+ describe "#prop_modified?" do
+ let(:service) do
+ BambooService.create(
+ project: create(:project),
+ properties: {
+ bamboo_url: 'http://gitlab.com',
+ username: 'mic',
+ password: "password"
+ }
+ )
+ end
+
+ it "returns false when the property has not been assigned a new value" do
+ service.username = "key_changed"
+ expect(service.prop_modified?(:bamboo_url)).to be_falsy
+ end
+
+ it "returns true when the property has been assigned a different value" do
+ service.bamboo_url = "http://example.com"
+ expect(service.prop_modified?(:bamboo_url)).to be_truthy
+ end
+
+ it "returns false when the property has been re-assigned the same value" do
+ service.bamboo_url = 'http://gitlab.com'
+ expect(service.prop_modified?(:bamboo_url)).to be_falsy
+ end
end
end