diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 18:06:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 18:06:00 +0000 |
commit | 77a73903aa803869d0ab7fe544cc2d8b1a6aa1e0 (patch) | |
tree | 0773f62090b7a896b29b8b08152565ba976716a8 /spec/models/grafana_integration_spec.rb | |
parent | ded8ee5a09a1a02209adf179ac7d6e456703726a (diff) | |
download | gitlab-ce-77a73903aa803869d0ab7fe544cc2d8b1a6aa1e0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/grafana_integration_spec.rb')
-rw-r--r-- | spec/models/grafana_integration_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/grafana_integration_spec.rb b/spec/models/grafana_integration_spec.rb index f8973097a40..615865e17b9 100644 --- a/spec/models/grafana_integration_spec.rb +++ b/spec/models/grafana_integration_spec.rb @@ -34,5 +34,36 @@ describe GrafanaIntegration do internal_url ).for(:grafana_url) end + + it 'disallows non-booleans in enabled column' do + is_expected.not_to allow_value( + nil + ).for(:enabled) + end + + it 'allows booleans in enabled column' do + is_expected.to allow_value( + true, + false + ).for(:enabled) + end + end + + describe '.client' do + subject(:grafana_integration) { create(:grafana_integration) } + + context 'with grafana integration disabled' do + it 'returns a grafana client' do + expect(grafana_integration.client).to be_an_instance_of(::Grafana::Client) + end + end + + context 'with grafana integration enabled' do + it 'returns nil' do + grafana_integration.update(enabled: false) + + expect(grafana_integration.client).to be(nil) + end + end end end |