summaryrefslogtreecommitdiff
path: root/spec/models/integrations/bamboo_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/integrations/bamboo_spec.rb')
-rw-r--r--spec/models/integrations/bamboo_spec.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/models/integrations/bamboo_spec.rb b/spec/models/integrations/bamboo_spec.rb
index 73ebf404828..60ff6685c3d 100644
--- a/spec/models/integrations/bamboo_spec.rb
+++ b/spec/models/integrations/bamboo_spec.rb
@@ -12,6 +12,7 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
subject(:integration) do
described_class.create!(
+ active: true,
project: project,
properties: {
bamboo_url: bamboo_url,
@@ -74,27 +75,27 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
end
describe 'Callbacks' do
- 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
integration.bamboo_url = 'http://gitlab1.com'
- integration.save!
+ expect(integration).not_to be_valid
expect(integration.password).to be_nil
end
it 'does not reset password if username changed' do
integration.username = 'some_name'
- integration.save!
+ expect(integration).to be_valid
expect(integration.password).to eq('password')
end
it "does not reset password if new url is set together with password, even if it's the same password" do
integration.bamboo_url = 'http://gitlab_edited.com'
integration.password = 'password'
- integration.save!
+ expect(integration).to be_valid
expect(integration.password).to eq('password')
expect(integration.bamboo_url).to eq('http://gitlab_edited.com')
end
@@ -107,8 +108,10 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
integration.password = 'password'
integration.save!
- expect(integration.password).to eq('password')
- expect(integration.bamboo_url).to eq('http://gitlab_edited.com')
+ expect(integration.reload).to have_attributes(
+ bamboo_url: 'http://gitlab_edited.com',
+ password: 'password'
+ )
end
end
end