diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 03:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 03:09:30 +0300 |
commit | 060c842402c00f830a810702600cbe39dfa6cf62 (patch) | |
tree | 743bd65ac0c1d4d6518ae8cdd4af5718ec7fb890 /spec/graphql/resolvers | |
parent | 6867eff1f997a881cd3ea64109f7ba2d4b42fde4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/resolvers')
-rw-r--r-- | spec/graphql/resolvers/environments_resolver_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/graphql/resolvers/environments_resolver_spec.rb b/spec/graphql/resolvers/environments_resolver_spec.rb index 35d53c29760..75fd7aff39c 100644 --- a/spec/graphql/resolvers/environments_resolver_spec.rb +++ b/spec/graphql/resolvers/environments_resolver_spec.rb @@ -10,9 +10,9 @@ describe Resolvers::EnvironmentsResolver do context "with a group" do let(:group) { create(:group) } let(:project) { create(:project, :public, group: group) } - let!(:environment1) { create(:environment, name: 'production', project: project) } - let!(:environment2) { create(:environment, name: 'test', project: project) } - let!(:environment3) { create(:environment, name: 'test2', project: project) } + let!(:environment1) { create(:environment, :available, name: 'production', project: project) } + let!(:environment2) { create(:environment, :stopped, name: 'test', project: project) } + let!(:environment3) { create(:environment, :available, name: 'test2', project: project) } before do group.add_developer(current_user) @@ -41,6 +41,18 @@ describe Resolvers::EnvironmentsResolver do end end + context 'with states' do + it 'searches environments by state' do + expect(resolve_environments(states: ['available'])).to contain_exactly(environment1, environment3) + end + + it 'returns error if requested state is invalid' do + expect { resolve_environments(states: ['invalid']) }.to( + raise_error(Gitlab::Graphql::Errors::ArgumentError) + ) + end + end + context 'when project is nil' do subject { resolve(described_class, obj: nil, args: {}, ctx: { current_user: current_user }) } |