summaryrefslogtreecommitdiff
path: root/spec/models/integrations/teamcity_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/models/integrations/teamcity_spec.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
downloadgitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/models/integrations/teamcity_spec.rb')
-rw-r--r--spec/models/integrations/teamcity_spec.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/models/integrations/teamcity_spec.rb b/spec/models/integrations/teamcity_spec.rb
index d425357aef0..0713141ea08 100644
--- a/spec/models/integrations/teamcity_spec.rb
+++ b/spec/models/integrations/teamcity_spec.rb
@@ -76,18 +76,18 @@ RSpec.describe Integrations::Teamcity, :use_clean_rails_memory_store_caching do
describe 'Callbacks' do
let(:teamcity_integration) { integration }
- describe 'before_update :reset_password' do
+ describe 'before_validation :reset_password' do
context 'when a password was previously set' do
it 'resets password if url changed' do
teamcity_integration.teamcity_url = 'http://gitlab1.com'
- teamcity_integration.save!
+ teamcity_integration.valid?
expect(teamcity_integration.password).to be_nil
end
it 'does not reset password if username changed' do
teamcity_integration.username = 'some_name'
- teamcity_integration.save!
+ teamcity_integration.valid?
expect(teamcity_integration.password).to eq('password')
end
@@ -95,7 +95,7 @@ RSpec.describe Integrations::Teamcity, :use_clean_rails_memory_store_caching do
it "does not reset password if new url is set together with password, even if it's the same password" do
teamcity_integration.teamcity_url = 'http://gitlab_edited.com'
teamcity_integration.password = 'password'
- teamcity_integration.save!
+ teamcity_integration.valid?
expect(teamcity_integration.password).to eq('password')
expect(teamcity_integration.teamcity_url).to eq('http://gitlab_edited.com')
@@ -109,8 +109,10 @@ RSpec.describe Integrations::Teamcity, :use_clean_rails_memory_store_caching do
teamcity_integration.password = 'password'
teamcity_integration.save!
- expect(teamcity_integration.password).to eq('password')
- expect(teamcity_integration.teamcity_url).to eq('http://gitlab_edited.com')
+ expect(teamcity_integration.reload).to have_attributes(
+ teamcity_url: 'http://gitlab_edited.com',
+ password: 'password'
+ )
end
end
end