diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-07 21:07:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-07 21:07:50 +0000 |
commit | d203316c80aa27cf747aa29df9f7c2d374965b5f (patch) | |
tree | aab5cde76fbf19a2639f6f9f3cb4f2acdc95f803 /spec/graphql/resolvers/projects | |
parent | 8dafc3b65aeb8f50fdfc38fb98d96c3db9e2f607 (diff) | |
download | gitlab-ce-d203316c80aa27cf747aa29df9f7c2d374965b5f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/resolvers/projects')
-rw-r--r-- | spec/graphql/resolvers/projects/grafana_integration_resolver_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/graphql/resolvers/projects/grafana_integration_resolver_spec.rb b/spec/graphql/resolvers/projects/grafana_integration_resolver_spec.rb new file mode 100644 index 00000000000..416a90a841f --- /dev/null +++ b/spec/graphql/resolvers/projects/grafana_integration_resolver_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Resolvers::Projects::GrafanaIntegrationResolver do + include GraphqlHelpers + + let_it_be(:project) { create(:project) } + let_it_be(:current_user) { create(:user) } + let_it_be(:grafana_integration) { create(:grafana_integration, project: project)} + + describe '#resolve' do + context 'when object is not a project' do + it { expect(resolve_integration(obj: current_user)).to eq nil } + end + + context 'when object is a project' do + it { expect(resolve_integration(obj: project)).to eq grafana_integration } + end + + context 'when object is nil' do + it { expect(resolve_integration(obj: nil)).to eq nil} + end + end + + def resolve_integration(obj: project, context: { current_user: current_user }) + resolve(described_class, obj: obj, ctx: context) + end +end |